x86 and likely other architectures provide a method to get the quotient and remainder in a single operation (DIV
). Because of this many languages have a DIVMOD combined operation, (like DIVREM
in C#, DIVMOD
in Python, or with div
and div_t
in C. How can I do this in Rust?
Is there an optimized method to perform both
let res = (a / b, a % b);