[llvm] [APFloat] Add APFloat support for E8M0 type (PR #107127)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 10:04:07 PDT 2024


================
@@ -396,7 +412,8 @@ static inline Error createError(const Twine &Err) {
 }
 
 static constexpr inline unsigned int partCountForBits(unsigned int bits) {
-  return ((bits) + APFloatBase::integerPartWidth - 1) / APFloatBase::integerPartWidth;
+  return std::max(1u, ((bits) + APFloatBase::integerPartWidth - 1) /
+                          APFloatBase::integerPartWidth);
----------------
arsenm wrote:

```suggestion
  return std::max(1u, (bits + APFloatBase::integerPartWidth - 1) /
                          APFloatBase::integerPartWidth);
```

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


More information about the llvm-commits mailing list