Re: [PATCH v3 3/3] rust: math: add signed division and remainder helpers

From: FUJITA Tomonori

Date: Wed Oct 21 2026 - 05:23:11 EST


On Sat, 17 Oct 2026 19:11:34 +0800
chenhan <chenhan0017.work@xxxxxxxxx> wrote:

> Delta's division and remainder implementations operate on integers and
> do not depend on time units. Move them into a math module to provide a
> common home for arithmetic helpers, with Delta as the initial user.
>
> Expose div64_s64() and rem_s64() so driver crates can use these operations
> without constructing time values. The division helper takes two i64
> operands; the remainder helper takes an i64 dividend and an i32 divisor
> and returns an i64. Both keep Rust's signed operator semantics, including
> the unconditional panic checks, and use the existing C helpers on 32-bit.
>
> Keep the Delta API and its panic documentation unchanged. This is separate
> from the preceding behavior fix so that introducing the math module is
> not required for a backport.
>
> Assisted-by: LLM
> Signed-off-by: chenhan <chenhan0017.work@xxxxxxxxx>

Reviewed-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>