[llvm] [APFloat] Add APFloat::format (PR #99088)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 00:28:52 PDT 2024


================
@@ -4596,6 +4596,38 @@ void IEEEFloat::makeZero(bool Negative) {
   APInt::tcSet(significandParts(), 0, partCount());
 }
 
+IEEEFloat::ExponentType IEEEFloat::getExponent() const { return exponent; }
+
+APInt IEEEFloat::getSignificand() const {
+  APInt result(semantics->precision,
+               ArrayRef<integerPart>(significandParts(), partCount()));
+
+  return result;
+}
+
+bool IEEEFloat::decomposeToIntegerAndPowerOf2(APInt &I, int &exp) const {
+  if (isNaN() || isInfinity())
+    return false;
+
+  if (isZero()) {
+    I = APInt(semantics->precision, 0);
+    exp = 0;
+  } else {
+    // the significant bits are the significand
----------------
arsenm wrote:

```suggestion
    // The significant bits are the significand
```

https://github.com/llvm/llvm-project/pull/99088


More information about the llvm-commits mailing list