BitNot


The BitNot function returns the bit-wise complement of a number. Use the NOT operation to invert the settings of all the bits in a number.

Syntax

nResult = BitNot( n )

bullet.gif    nResult is the bit-wise NOT of n.

bullet.gif    n is an integer number.

Remarks

The bit-wise NOT flips all 1 bits to 0 and vice versa. For example, consider the number 15. In binary notation this is expressed as 1111. Using all 32 buts, this number is 00000000000000000000000000001111. The bit-wise NOT sets all 0 bits to 1 and the lower 4 1-bits to 0, giving the result 11111111111111111111111111110000.

Example

The following script performs the NOT of a number. Note that the result is printed using %u because it is considered an unsigned (i.e., 0 or positive) integer.

n = 7

-- pick two numbers

Printf( "'%u'", BitNot( n ) )

-- prints the result 4294967288

Related Topics

Boolean Math Functions


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.