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 - setbit() set specified bit http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setbit()            Set specified bit
------------------------------------------------------------------------------
 Declaration
   bit.hdr

 Syntax
   proc setbit extern
   param       untyped xNumber, ;
         value uint    uBit

 Arguments
   xNumber is the value to operate on.
   uBit specifies the bit to set.

 Return
   None.

 Description
   setbit() sets a bit in the specified value xNumber. The lowest bit is
   addressed with uBit set to 0. The highest bit address depends on the
   type of xNumber.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_setbit
   vardef
      uint uValue
   enddef
   // set the blink bit in an attribute value
   __syscolor[ CLR_STD ] := WHITE_BLUE
   ? __syscolor[ CLR_STD ]
   setbit( __syscolor[ CLR_STD ], 7 )
   ? __syscolor[ CLR_STD ]
   
   // make a number odd
   uValue := 8
   ? uValue
   setbit( uValue, 0 )
   ? uValue
   endproc

   proc main
   Test_setbit()
   endproc

See Also: resetbit()

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