BitNot

Use this function to return the result of a bitwise logical NOT operation performed on a numeric value.

Syntax

BitNot(value1)

The parameter specifies the numeric value on which the bitwise logical NOT operation is performed. If the parameter is not an integer, it will be converted to an integer before the bitwise logical NOT operation is performed.

The bitwise logical NOT operation reverses the sense of the bits in the value. For each value bit that is 1, the corresponding result bit will be set to zero (0). For each value bit that is zero (0), the corresponding result bit will be set to 1.

It is especially important to note that integer values have 32 bits to compare when examining the results of a NOT operation. All bits of the integer will be altered by this operation.

The following table shows the result of a bitwise logical NOT operation:

Value1 bit

Result bit

0

1

1

0

Example

Here is an example:

x = 3 (3 is 0000 0000 0000 0000 0000 0000 0000 0011 in binary)

 

z = BitNot(x)

z = -4 (-4 is 1111 1111 1111 1111 1111 1111 1111 1100 in binary)

Notice that the NOT operation affects all bits of the integer.

See also