Mojo function
udivmod_unchecked
udivmod_unchecked(a: Int, b: Int) -> Tuple[Int, Int]
Unsigned divmod without zero-guard.
Unlike udivmod, this uses UInt.__truediv__ (pop.div) which emits
a raw unsigned division without the zero-guard (icmp eq 0 + umax +
select) that UInt.__floordiv__ and UInt.__mod__ insert. 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:
Tuple: A Tuple of (quotient, remainder) from unsigned division.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!