SplitScript reference / Integer / shiftRight

Integer.shiftRight

Operator

T.shiftRight(count: T) -> T where T: Integer

Shifts bits to the right.

This method is also the implementation of the >> operator. Signed values copy the sign bit; unsigned and address values shift in zeroes. Shift counts use the same low-five or low-six-bit rule as shiftLeft.

Parameters

  • count: The shift count, inferred as the receiver's integer type.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Extract a packed byte

let highByte = 0x1234u32 >> 8