[Main]
Title=Bitwise shift operators ('<<' and '>>')
Index=<<, >>

[Top]
Bitwise shift operators in C use the following syntax:
<PRE><I>expr1</I> &lt;&lt; <I>expr2</I>
<I>expr1</I> &gt;&gt; <I>expr2</I>
</PRE>
In the expressions <I>expr1</I>&nbsp;&lt;&lt;&nbsp;<I>expr2</I> and
<I>expr1</I>&nbsp;&gt;&gt;&nbsp;<I>expr2</I>, the operands <I>expr1</I>
and <I>expr2</I> must be of integral type. The normal integral promotions are performed
on <I>expr1</I> and <I>expr2</I>,
and the type of the result is the type of the promoted <I>expr1</I>.
If <I>expr2</I> is negative or is greater than or equal to the width in bits of
<I>expr1</I>, the operation is undefined.
<BR><BR>
The result of the operation <I>expr1</I>&nbsp;&lt;&lt;&nbsp;<I>expr2</I>
is the value of <I>expr1</I> left-shifted by <I>expr2</I> bit positions,
zero-filled from the right if necessary.
The result of the operation <I>expr1</I>&nbsp;&gt;&gt;&nbsp;<I>expr2</I>
is the value of <I>expr1</I> right-shifted by <I>expr2</I> bit positions.
