Binary not

The -bnot operator is applied before a numeric value; it does not use a value on the left-hand side. The result is a value comprised of all bits that are not set.

The -bnot operator works with signed and unsigned 32-bit and 64-bit integers (Int32, UInt32, Int64, and UInt64). When working with 8-bit or 16-bit integers (SByte, Byte, Int16, and UInt16), the result is always a signed 32-bit integer (Int32).

In the following example, the result is -123:

-bnot 122 

As the preceding result is a 32-bit integer (Int32), it is difficult to show the effect in a small table. If this value were a SByte, the operation could be expressed in a table as follows:

Bit value

 

Signing

64

32

16

8

4

2

1

Before -bnot

122

0

1

1

1

1

0

1

0

After -bnot

-123

1

0

0

0

0

1

0

1

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.50.87