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 - testbit() test if a bit is set in a number http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 testbit()           Test if a bit is set in a number
------------------------------------------------------------------------------
 Declaration
   bit.hdr

 Syntax
   func logical testbit extern
   param       untyped xNumber, ;
         value uint    uBit

 Arguments
   xNumber is a numeric value.
   uBit is the bit position to test.

 Return
   A logical indicating if the specified bit is set.

 Description
   The testbit() function returns .t. if the bit given by the uBit parameter 
   set in xNumber.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_testbit
   vardef
      byte bNum
      uint n
   enddef
   bNum := 10101010B
   for n := 0 to 7
      ? testbit( bNum, n )
   next
   endproc

   proc main
   Test_testbit()
   endproc

See Also: maskbit()

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