Skip to main content
Log in

Mojo function

shiftl

shiftl(a: Int, s: Int) -> Int

Shift left or right based on sign of shift amount.

Performs a left shift if s is positive, or a right shift if s is negative.

Args:

  • a (Int): The integer value to shift.
  • s (Int): The shift amount. Positive for left, negative for right.

Returns:

The shifted integer value.

shiftl(a: SIMD[dtype, 1], s: SIMD[dtype, 1]) -> SIMD[dtype, 1]

Shift left/right based on sign of shift for scalars.

Scalar version of shiftl. Left shift if s is positive, right shift if s is negative.

Args:

  • a (SIMD[dtype, 1]): The scalar value to shift.
  • s (SIMD[dtype, 1]): The scalar shift amount. Positive for left, negative right.

Returns:

The shifted scalar value.