Mojo function
rotate_bits_right
rotate_bits_right[shift: Int](x: Int) -> Int
Shifts the bits of an input to the right by shift bits (with wrap-around).
Constraints:
-size <= shift < size
Parameters:
- shift (
Int): The number of bit positions by which to rotate the bits of the integer to the right (with wrap-around).
Args:
- x (
Int): The input value.
Returns:
Int: The input rotated to the right by shift elements (with wrap-around).
rotate_bits_right[dtype: DType, width: Int, //, shift: Int](x: SIMD[dtype, width]) -> SIMD[dtype, width]
Shifts bits to the right by shift positions (with wrap-around) for each element of a SIMD vector.
Constraints:
0 <= shift < size
Parameters:
- dtype (
DType): Thedtypeof the input and output SIMD vector. Must be integral and unsigned. - width (
Int): The width of the SIMD vector. - shift (
Int): The number of positions to rotate right.
Args:
- x (
SIMD): SIMD vector input.
Returns:
SIMD: SIMD vector with each element rotated right by shift bits.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!