Description
The operators right-shift (>>), left-shift (<<) operate on all scalar
and vector built-in types except the built-in scalar and vector float
types.
For built-in vector types, the operators are applied component-wise.
For the right-shift (>>), left-shift (<<) operators, the rightmost
operand must be a scalar if the first operand is a scalar, and the rightmost
operand can be a vector or scalar if the first operand is a vector.
The result of E1 << E2 is E1 left-shifted by log2(N) least significant
bits in E2 viewed as an unsigned integer value, where N is the number of bits
used to represent the data type of E1 after integer promotion
[1], if E1 is a scalar, or the number of bits
used to represent the type of E1 elements, if E1 is a vector.
The vacated bits are filled with zeros.
The result of E1 >> E2 is E1 right-shifted by log2(N) least
significant bits in E2 viewed as an unsigned integer value, where N is the
number of bits used to represent the data type of E1 after integer
promotion, if E1 is a scalar, or the number of bits used to represent the
type of E1 elements, if E1 is a vector.
If E1 has an unsigned type or if E1 has a signed type and a nonnegative
value, the vacated bits are filled with zeros.
If E1 has a signed type and a negative value, the vacated bits are filled
with ones.
Document Notes
For more information, see the OpenCL C Specification
This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.