not_bits
Definition: | atom x2 = not_bits(atom x1) |
Description: | Perform the logical NOT operation on each bit in x1. A bit in x2 will be 1 when the corresponding bit in x1 is 0, and will be 0 when the corresponding bit in x1 is 1. |
pwa/p2js: | Supported. |
Comments: |
This function may be applied to an atom or sq_not_bits() to all elements
of a sequence. The rules for sequence operations apply. The argument must be representable as a 32-bit number, either signed or unsigned. If you intend to manipulate full 32-bit values, you should declare your variables as atom, rather than integer. The integer type is limited to 31-bits. Results are treated as signed numbers. They will be negative when the highest-order bit is 1. Caution: many cryptographic functions and the like require unsigned 32-bit integers, especially when bit-shifting, for which not_bitsu() can be used instead. Unlike and_bits() and or_bits(), there is no (prefix) operator alternative to not_bits(). |
Example: |
a = not_bits(#000000F7) -- a is -248 (i.e. FFFFFF08 interpreted as a negative number) |
Implementation: | via :%opNotBits in builtins\VM\pUnary.e and builtins/ubits.e (both autoincludes). |
See Also: | and_bits, or_bits, xor_bits, int_to_bits |