Mojo function
udiv_unchecked
udiv_unchecked(a: Int, b: Int) -> Int
Unsigned division without zero-guard.
Unlike ufloordiv, this uses UInt.__truediv__ (pop.div) which emits
a raw unsigned division without the zero-guard that UInt.__floordiv__
inserts. This produces tighter codegen on GPUs where the guard is
unnecessary overhead.
The caller must guarantee that b > 0. Behavior is undefined otherwise.
Args:
Returns:
Int: The quotient of unsigned division.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!