Function Reference


BitAND

Performs a bitwise AND operation.

BitAND ( value1, value2 [, value n] )

Parameters

value1 The first number.
value2 The second number.
value n [optional] The nth number - up to 255 values can be specified.

Return Value

Returns the value of the parameters bitwise-AND'ed together.
Bit operations are performed as 32-bit integers.

Remarks

Remember hex notation can be used for numbers.
BitAND() returns 1 in each bit position where all input arguments have a 1 in the corresponding position and 0 in all others.

Related

BitNOT, BitOR, BitRotate, BitShift, BitXOR, Hex

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Note: "b" is the symbol for byte.

    ; Assign a Local variable the bitwise AND operation of 1 and 0.
    Local $iBitAND1 = BitAND(1, 0)

    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitAND1)

    ; Assign a Local variable the bitwise AND operation of 1 and 1.
    Local $iBitAND2 = BitAND(1, 1)

    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitAND2)

    ; Assign a Local variable the bitwise AND operation of 13 (1101b) and 7 (0111b).
    Local $iBitAND3 = BitAND(13, 7) ; 1101b AND 0111b = 0101b

    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitAND3)

    ; Assign a Local variable the bitwise AND operation of 2 (0010b), 3 (0011b) and 6 (0110b).
    Local $iBitAND4 = BitAND(2, 3, 6) ; 0010b AND 0011b AND 0110b = 0010b

    ; Display the result.
    MsgBox($MB_SYSTEMMODAL, "", $iBitAND4)
EndFunc   ;==>Example