[libc-commits] [libc] [wip][libc] Implemented fixed point divifx functions in llvm-libc (PR #138238)

via libc-commits libc-commits at lists.llvm.org
Mon May 5 10:26:24 PDT 2025


PiJoules wrote:

> @PiJoules For now I have tried implementing `divir` function. Can you check the logic for `divifx` function? Then, I can move forward with this PR.

Casting up then shifting before an integral division I think is a good general approach. Rather than unconditionally using a 128-bit int I think it would be instead better to cast just to an appropriate storage of a higher rank. Perhaps you can add something to `internal::Storage` along the lines of `using HigherRankStorage = ...` then you can use that in place of `Intermediate[Un]Signed`. I think it would also help to add some tests to assert we're not missing edge cases.

https://github.com/llvm/llvm-project/pull/138238


More information about the libc-commits mailing list