[libc-commits] [PATCH] D148759: [libc] Support constexpr uint initialization
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Apr 20 11:24:11 PDT 2023
michaelrj added inline comments.
================
Comment at: libc/src/__support/FPUtil/x86_64/LongDoubleBits.h:52
static constexpr UIntType MAX_NORMAL =
- ((UIntType(MAX_EXPONENT) - 1)
+ ((UIntType(MAX_EXPONENT - 1))
<< (MantissaWidth<long double>::VALUE + 1)) |
----------------
sivachandra wrote:
> Why was this change required?
This change isn't required, it's from when I was trying to move the constants away from addition and subtraction. That being said, I do think leaving this change would be good because we could remove an extra set of parentheses.
================
Comment at: libc/src/__support/UInt.h:89
+ constexpr explicit operator uint16_t() const {
+ return uint16_t(uint64_t(*this));
----------------
sivachandra wrote:
> Is this required for the functionality of this change?
yes, because without this the casts in LongDoubleBits don't work with UInt.
A related question might be "why are there casts in LongDoubleBits?" The answer is I was testing the constant functionality by using UInt<128> instead of the builtin uint_128 on my x86_64 workstation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148759/new/
https://reviews.llvm.org/D148759
More information about the libc-commits
mailing list