IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

shiftl

def 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:

Int: The shifted integer value.

def shiftl(a: Scalar, s: Scalar[a.dtype]) -> Scalar[a.dtype]

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 (Scalar): The scalar value to shift.
  • ​s (Scalar[a.dtype]): The scalar shift amount. Positive for left, negative right.

Returns:

Scalar[a.dtype]: The shifted scalar value.

Was this page helpful?