[PATCH] D139120: APFloat: Add isSmallestNormalized predicate function

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 21:14:06 PST 2022


sepavloff added inline comments.


================
Comment at: llvm/include/llvm/ADT/APFloat.h:396
 
+  /// Returns if this is the smallest (by magnitude) normalized finite number in
+  /// the given semantics.
----------------
Returns *true* if...


================
Comment at: llvm/lib/Support/APFloat.cpp:5017-5021
+  if (!Floats[1].isPosZero())
+    return false;
+  uint64_t SignBit = static_cast<uint64_t>(isNegative()) << 63;
+  APFloat LoHalf(semIEEEdouble, APInt(64, 0x0360000000000000ull | SignBit));
+  return Floats[0] == LoHalf;
----------------
What prevents from using the same technique as in `isSmallest`? It looks more readable.


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

https://reviews.llvm.org/D139120



More information about the llvm-commits mailing list