BitwiseAnd()

Summary

Computes the bitwise AND of two integers.

Syntax

int = BitwiseAnd(integer int1, integer int2)

Argument Contents
int1 First integer
Int2 Second integer

Returns

An integer that is the bitwise AND of the two integer arguments.

Notes

  • A bit must be set to 1 in both integer arguments for it to be set to 1 in the resulting integer; otherwise it will be set to 0.

Examples

int = BitwiseAnd(7, 3) // int = 3: in binary, 111 AND 011 = 011
int = BitwiseAnd(8, 3) // int = 0: in binary, 1000 AND 0011 = 0000
int = BitwiseAnd(8, -1) // int = 8: all bits are set to 1 in -1

See Also

Function Summary
BitwiseNot() Computes the bitwise NOT of an integer
BitwiseOr() Computes the bitwise OR of two integers
BitwiseXor() Computes the bitwise exclusive OR of an integer
ShiftLeft() Performs a left arithmetic shift of the bits in an integer
ShiftRight() Does a right arithmetic shift of the bits in an integer