8.6. Shift Operators

8.6.1. The << Operator

The left-shift operator (<<) shifts its LHS operand left by the number of bits specified by its RHS operand:

expr << count

Here, expr is the expression of type int, uint, long, or ulong and is the value to be shifted; count is the shift count and must be an int. If expr is an int or uint (a 32-bit quantity), the shift count is given by the low-order five bits of count (count & 0x1f). If expr is a long or ulong (a 64-bit quantity), the shift count is given by the low-order six bits of count (count & 0x3f). The high-order bits of expr are discarded, and the low-order empty bits are zero-filled.

8.6.2. The >> Operator

The right-shift operator (>>) shifts its LHS operand right by the number of bits specified ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.