util.Integer.andNot
Returns the result of a bitwise AND of the 1st
INTEGER and the inverted 2nd INTEGER.
Syntax
util.Integer.andNot(
x INTEGER,
y INTEGER
)
RETURNS INTEGER
- x is an integer value.
- y is an integer value.
Usage
The
util.Integer.andNot() method makes a bitwise AND operation with the first
integer value and the second inverted
integer: x : 210 (00000000 00000000 00000000 11010010)
y : 135 (00000000 00000000 00000000 10000111)
~y : (11111111 11111111 11111111 01111000)
--------------------------------------------------
result : 80 (00000000 00000000 00000000 01010000)This method simplifies mask operations.
Note: Bitwise methods provided by the
util.Integer class are
based on the INTEGER type. Consider the following facts when using these methods: - The
INTEGERtype is a four-byte signed integer: If the bit at position 31 is set to 1, the correspondingINTEGERvalue will be negative. Thus,util.Integer.not(0)produces theINTEGERvalue-1(11111111 11111111 11111111 11111111). - The
NULLvalue for theINTEGERtype is represented internally with the value0x80000000(10000000 00000000 00000000 00000000). WhenNULLis used with theutil.Integerbitwise methods, it will be interpreted as0x80000000instead of a null value. However, if the result of the bitwise operation produces the value0x80000000, it will be interpreted asNULLwhen used in an expression.
Example
IMPORT util
MAIN
DISPLAY util.Integer.andNot( 3, 2 ) -- displays 1
END MAIN