BITAND()

BITAND()

Top  Previous  Next

 

The BITAND() function forms the bitwise logical AND of two integer values.

 

 

Format

 

BITAND(expr1, expr2)

 

where

 

expr1 and expr2 evaluate to integers

 

 

The BITAND() function converts expr1 and expr2 to 32 bit integers and performs a bit-by-bit logical AND to form a new integer value as the result.

 

The value of each bit in the result is 1 if same bit position in both of expr1 and expr2 is 1.

 

 

Example

 

IF BITAND(N, 1) THEN N += 1

 

This statement adds one to N if the least significant bit is 1. The effect is to round N to an even integer.

 

 

See also:

BITNOT(), BITOR(), BITRESET(), BITSET(), BITTEST(), BITXOR(), SHIFT()