BitNor


The BitNor function returns the bit-wise NOR of two numbers. NOR means "NOT OR". This finds the bits that are not present in either number and sets them to 1 in the result.

Syntax

nResult = BitNor( n1, n2 )

bullet.gif    nResult is the bit-wise NOR of n1 and n2.

bullet.gif    n1 and n2 are two numbers (integers).

Remarks

The bit-wise NOR of two numbers finds all bits that are 0 in both numbers and sets them to 1 in the result. For example, consider 7 NOR 18. In binary representation this is (111 NOR 10010). Only the bit at position 4 is 0 in both numbers, as are all high-order bits not shown. Bit 4 and the high-order bits are therefore set to 1 in the result. Thus (7 NOR 18) = 11111111111111111111111111101000 binary.

Example

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

n1 = 7 n2 = 18

-- pick two numbers

Printf( "'%u'", BitNor( n1, n2 ) )

-- prints the result 4294967272

Related Topics

Boolean Math Functions

BitOr

BitXor


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