Skip to main content

function

rotate_bits_left

rotate_bits_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_bits_left[shift: Int, type: DType, width: Int](x: SIMD[type, width]) -> SIMD[$1, $2]

Shifts bits to the left by shift positions (with wrap-around) for each element of a SIMD vector.

Constraints:

0 <= shift < size

Parameters:

  • shift (Int): The number of positions by which to shift left the bits for each element of a SIMD vector to the left (with wrap-around).
  • type (DType): The dtype of the input and output SIMD vector. Constraints: must be integral and unsigned.
  • width (Int): The width of the input and output SIMD vector.

Args:

  • x (SIMD[type, width]): SIMD vector to perform the operation on.

Returns:

The SIMD vector with each element's bits shifted to the left by shift bits (with wrap-around).