Re: [PATCH v1] rust: time: Avoid 64-bit integer division
From: Andreas Hindborg
Date: Mon May 05 2025 - 06:46:38 EST
FUJITA Tomonori <fujita.tomonori@xxxxxxxxx> writes:
> Avoid 64-bit integer division that 32-bit architectures don't
> implement generally. This uses ktime_to_ms() and ktime_to_us()
> instead.
>
> The timer abstraction needs i64 / u32 division so C's div_s64() can be
> used but ktime_to_ms() and ktime_to_us() provide a simpler solution
> for this timer abstraction problem. On some architectures, there is
> room to optimize the implementation of them, but such optimization can
> be done if and when it becomes necessary.
>
> One downside of calling the C's functions is that the as_micros/millis
> methods can no longer be const fn. We stick with the simpler approach
> unless there's a compelling need for a const fn.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>
Please consult recent MAINTAINERS file when you send patches. If you
intend for me to see a patch, please use my registered email address.
Best regards,
Andreas Hindborg