O'Reilly logo

Computing with C# and the .NET Framework, 2nd Edition by Gittleman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

B Bitwise and Shift Operators

We typically use base 10 integers in our program, which are represented internally as binary numbers. C# int values always use 32 bits. Thus C# represents the number 25 internally as

0000 0000 0000 0000 0000 0000 0001 1001

image BITWISE OPERATORS

C# has several bitwise operators that operate on each bit of an int value.

image

Figure B.1 shows the effects of these operations on corresponding bits of each operand.

FIGURE B.1 The effect of bitwise operators

To illustrate these operators we use 4-bit values for simplicity, rather ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required