[libc-commits] [libc] [libc][stdfix] Implement fxdivi functions (rdivi) (PR #154914)
Shreeyash Pandey via libc-commits
libc-commits at lists.llvm.org
Wed Oct 8 08:36:50 PDT 2025
================
@@ -244,8 +246,35 @@ template <typename XType> LIBC_INLINE constexpr XType divi(int n, int d) {
if (LIBC_UNLIKELY(n == 0)) {
return FXRep<XType>::ZERO();
}
- bool result_is_negative = ((n < 0) != (d < 0));
+ auto isPowerOfTwo = [](int n) { return (n > 0) && ((n & (n - 1)) == 0); };
----------------
bojle wrote:
done
https://github.com/llvm/llvm-project/pull/154914
More information about the libc-commits
mailing list