BitNot
Revision as of 19:42, 31 December 2015 by Lchrisman (talk | contribs) (Created page with "category:Bit functions ''new in Analytica 4.7'' == BitNot( x ) == Returns the bitwise one's complement of the integer portion of a number. Each 1 bit in «x» is ch...")
new in Analytica 4.7
BitNot( x )
Returns the bitwise one's complement of the integer portion of a number. Each 1 bit in «x» is changed to 0, and each 0 bit changed to «1».
Each integer is treated as having 64 bits. The two's complement binary representation is used for negative numbers.
This will generally be equivalent to -(x+1)
when «x» is an integer, but if you are manipulating the bits of an integer, the use of this function makes your intent more obvious.
Examples
BitNot( 55 ) → -56
The same example shown in binary notation makes the bit inversion obvious
BitNot( 0b110111) → 0b1111111111111111111111111111111111111111111111111111111111001000
See Also
Comments
Enable comment auto-refresher