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 - and() perform a logical and on two numbers http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 and()               Perform a logical AND on two numbers
------------------------------------------------------------------------------
 Declaration
   bit.hdr

 Syntax
   func uint and extern
   param value uint uNumber1, ;
         value uint uNumber2

 Arguments
   uNumber1 is a numeric expression
   uNumber2 is a numeric expression.

 Return
   The result of the AND operation.

 Description
   The and() function performs a bitwise AND operation on the two parameters
   uNumber1 and uNumber2.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_and
   /* decimal representation   binary representation
   
            7                           00000111
            2                           00000010
                 AND                    --------
            2                   Result: 00000010
   */
   ? and( 00000111B, 00000010B )                    // prints 2
   ? and( 7, 2 )                                    // prints 2
   ? right( dechex( and( 0x0ff0, 0xff00 ) ), 4 )    // prints 0F00
   endproc

   proc main
   Test_and()
   endproc

See Also: not() or() xor()

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