Skip to main content

function

rotate_right

rotate_right[shift: Int](x: Int) -> Int

Shifts the bits of a 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:

The input rotated to the right by shift elements (with wrap-around).

rotate_right[shift: Int, type: DType, size: Int](x: SIMD[type, size]) -> SIMD[$1, $2]

Shifts the elements of a SIMD vector to the right by shift elements (with wrap-around).

Constraints:

-size < shift <= size

Parameters:

  • shift (Int): The number of positions by which to rotate the elements of SIMD vector to the right (with wrap-around).
  • type (DType): The DType of the input and output SIMD vector.
  • size (Int): The width of the input and output SIMD vector.

Args:

  • x (SIMD[type, size]): The input value.

Returns:

The SIMD vector rotated to the right by shift elements (with wrap-around).