FreeBASIC - Bitwise not: not

Bitwise 1 complement, also known as bit negation or bit-denial operation. operates on the basis of logical negation, if input is 0 then output is 1, and if input is 1 the result is 0. for example you can use it for bit deletion, or bit set to simplify the creation of masks. for example, at one variable we want to set to 1 all bits except the first 3 bits, in which case we will use a bitwise OR, given what we need one mask in case of 16-bit variable is a number 65528, using a bitwise negation we can use a simpler form number 7. reasoning is as follows, with the exception of the first three bits we want to set bits to 1, we need a mask where the first three bits are 0 and the other 1, the opposite is the first of three bits are 1 other 0, this number is simple to calculate, and then apply a bitwise negation and we have done.

not

Description

not par1
Used keywords: not

Input


Output

Examples

FreeBASIC

Bitwise not the possible of use:
x = not(32 shr 2)       ' x = -9
y = not x              ' y = 8
z = not(x and 5) and y    ' z = 8

FreeBASIC

Even one example in what situations we can use the operation bitwise not:
not i
not&Habcd
not(i and 4)

FreeBASIC

Other pieces of example codes:
not 2

You can find it in the following collections: bitwise operators
Languages: en hu cz sk