Some function added in preparation to fmod commit.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/__support/FPUtil/FPBits.h | ||
---|---|---|
129 | I forget whether for 80-bit long double, bits 80-127 might contain garbage or not. Would you mind double checking that? If that's the case, you might simply add EXPONENT_MANTISSA_MASK (or abbreviated to EXP_MANT_MASK is up to you) and use that instead of ~SIGN_MASK. |
libc/src/__support/FPUtil/FPBits.h | ||
---|---|---|
129 | Probably, I did not get your idea fully. long double representation is significantly different from float, double or quad therefore it is covered by separate FBits class (see LongDoubleBits.h). Do you want me to improve that class also? If yes, I don't think that it should be done in the review. There are a lot of checks which should be done and I prefer it to be in a separate review. |
As with the other patch, while this is accepted, please hold-off on submitting until further notice here.
libc/src/__support/FPUtil/FloatProperties.h | ||
---|---|---|
36 | We should use a more formal tone. So, may be: "Exponent and mantissa masks are not as expected." | |
46 | Why is multiplication by 8 preferred over shift by 3? |
libc/src/__support/FPUtil/FloatProperties.h | ||
---|---|---|
46 | Just to improve readability. Everybody knows, that byte has 8 bits. But in previous representation it should:
Of course, it is not a big problem, but the code is still complex and need attention. And we should not add extra complications for nothing. |
libc/src/__support/FPUtil/FloatProperties.h | ||
---|---|---|
46 | To be absolutely clear, I am OK with using * 8 in this patch. At the same time, I would have found the reasoning more appealing if it was like, "we should let the compilers choose the best instructions for the semantic of multiplying by 8." |
libc/src/__support/FPUtil/FloatProperties.h | ||
---|---|---|
46 | To be absolutely clear, I'll use your suggestion in the future. It is absolutely reasonable. But in this particular case, this is a` constexpr`, therefore the "best instruction" never appears in the code. It will be done during the compile time, so will not affect runtime at all. |
I forget whether for 80-bit long double, bits 80-127 might contain garbage or not. Would you mind double checking that? If that's the case, you might simply add EXPONENT_MANTISSA_MASK (or abbreviated to EXP_MANT_MASK is up to you) and use that instead of ~SIGN_MASK.