Skip to main content

function

rotate_left

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

Shifts the bits of a input to the left 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 left (with wrap-around).

Args:

  • x (Int): The input value.

Returns:

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

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

Shifts the elements of a SIMD vector to the left 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 left (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 left by shift elements (with wrap-around).