Mojo function
shiftr
shiftr(a: Int, s: Int) -> Int
Shift right or left based on sign of shift amount.
Performs a right shift if s is positive, or a left shift if
s is negative.
Args:
- βa (
Int): The integer value to shift. - βs (
Int): The shift amount. Positive for right, negative for left.
Returns:
Int: The shifted integer value.
shiftr(a: Scalar[dtype], s: Scalar[dtype]) -> Scalar[dtype]
Shift right/left based on sign of shift for scalars.
Scalar version of shiftr. Right shift if s is positive,
left shift if s is negative.
Args:
- βa (
Scalar): The scalar value to shift. - βs (
Scalar): The scalar shift amount. Positive for right, negative left.
Returns:
Scalar: The shifted scalar value.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!