Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - barrget() get a bit array element http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 barrget()           Get a bit array element
------------------------------------------------------------------------------
 Declaration
   bit.hdr

 Syntax
   func logical barrget extern
   param value _BITARRAY nArrayHandle, ;
         value ulong     nElement

 Arguments
   nArrayHandle is a bit array handle.

   nElement is the index of the element to retrieve. Bit arrays are 0-based.

 Return
   A logical indicating if the given bit element is set.

 Description
   The barrget() function retrieves the status of an individual bit
   in a bit array.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_barrget
   vardef
      _BITARRAY pArr
      uint      n
   enddef
   pArr := barrinit( 1000, .f. )     // allocate bit array
   for n := 871 to 881               // show a range of bits
      ? n, barrget( pArr, n )
   next
   ?
   for n := 871 to 881 step 2        // set every second bit
      barrset( pArr, n, .t. )
   next
   for n := 871 to 881               // show a range of bits
      ? n, barrget( pArr, n )
   next
   barrclear( pArr )                 // free array
   endproc

   proc main
   Test_barrget()
   endproc

See Also: barrset()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson