SplitScript reference / Integer / shiftRight

Integer.shiftRight

Operator

Self.shiftRight(count: Self) -> Self where Self: 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