[PATCH v3 1/2] rust: math: add div64_u64() and div64_u64_round_up()

Alice Ryhl aliceryhl at google.com
Wed Nov 18 12:52:36 PST 2026


On Fri, Oct 30, 2026 at 3:02 AM FUJITA Tomonori <tomo at flapping.org> wrote:
> +#[inline]
> +pub fn div64_u64(dividend: u64, divisor: u64) -> u64 {

You're missing #[track_caller] on both functions.

> +    if divisor == 0 {
> +        panic!("attempt to divide by zero");
> +    }

I suspect the panic built-in to the / operator may be more efficient,
so please move this panic inside #[cfg(not(CONFIG_64BIT))].

Alice



More information about the linux-riscv mailing list