⇤ ← 于2007-07-18 22:33:11修订的的版本1
882
备注:
|
935
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 1: | 行号 1: |
## page was renamed from TCPL/A.7.8 Shift Operators |
A.7.8 Shift Operators
The shift operators << and >> group left-to-right. For both operators, each operand must be integral, and is subject to integral the promotions. The type of the result is that of the promoted left operand. The result is undefined if the right operand is negative, or greater than or equal to the number of bits in the left expression's type.
- shift-expression:
- additive-expression
shift-expression << additive-expression shift-expression >> additive-expression
- additive-expression
The value of E1<<E2 is E1 (interpreted as a bit pattern) left-shifted E2 bits; in the absence of overflow, this is equivalent to multiplication by 2E2. The value of E1>>E2 is E1 right-shifted E2 bit positions. The right shift is equivalent to division by 2E2 if E1 is unsigned or it has a non-negative value; otherwise the result is implementation-defined.