[libc-commits] [PATCH] D127097: [libc][math] Improved FBits performance and readablity.

Kirill Okhotnikov via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 6 07:21:10 PDT 2022


orex added inline comments.


================
Comment at: libc/src/__support/FPUtil/FPBits.h:129
   bool is_inf() const {
-    return get_mantissa() == 0 && get_unbiased_exponent() == MAX_EXPONENT;
+    return (bits & (~(FloatProp::SIGN_MASK))) == FloatProp::EXPONENT_MASK;
   }
----------------
lntue wrote:
> 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`.
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 for the mask, it looks like that it is a good idea. I'll implement this. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127097/new/

https://reviews.llvm.org/D127097



More information about the libc-commits mailing list