a bitwise Not
x% = ~ i
i:integer expression
~ i inverts the bit pattern in i.
The one's complement operator, sometimes called the "bitwise complement" or "bitwise NOT" operator, produces the bitwise one's complement of its operand. The operand must be of integral type. This operator performs usual arithmetic conversions; the result has the type of the operand after conversion.
Print Bin$(3, 32) // Prints 00000000000000000000000000000011
Print Bin$(10, 32) // Prints 00000000000000000000000000001010
Print Bin$(~3, 32) // Prints 11111111111111111111111111111100
Print Bin$(~10, 32) // Prints 11111111111111111111111111110101
Not is synonymous with ~ and can be used instead. However, ~ has higher priority so
a% = ~b% + 4 = (Not b%) + 4
a% = ~(b% + 4) = Not b% + 4
And, Or, Xor, Not, Imp, Eqv, %&, |
{Created by Sjouke Hamstra; Last updated: 20/09/2017 by James Gaite}