bitNot
Performs a bitwise NOT (~) operation, inverting every bit of the input integer (0 becomes 1, 1 becomes 0).
Core Advantages
Provides a high-performance method for creating inverted masks or flipping all flags at once. It's commonly used for clearing specific bits or building complex bitwise logic.
Common Uses
Creating an inverted mask to clear or isolate specific bits.
Flipping all state flags within an integer simultaneously.
Combining with `bitAnd` to perform 'clear-and-set' bitwise operations.
In conditional logic, to check if a set of flags does not contain a specific flag.
How to adjust
This node takes a single integer input and its output is the complete bitwise inversion of that integer. It has no parameters to 'adjust'. Changing the input value directly yields a new, bit-inverted integer output. For example, for an input of `5` (binary `...0101`), the output of `bitNot(5)` is `-6` (binary `...1010` in two's complement).
Code Examples
1// Create a mask to clear the lower 8 bits, preserving the upper bits
2const MASK_CLEAR_LOW_8_BITS = bitNot( 0xFF );
3let highBits = bitAnd( myInteger, MASK_CLEAR_LOW_8_BITS );