[libc-commits] [libc] [llvm] [libc] Add `next_toward_inf` fo `FPBits` (PR #80654)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Mon Feb 5 02:39:27 PST 2024


================
@@ -435,6 +445,13 @@ struct FPRepSem : public FPStorage<fp_type> {
   LIBC_INLINE constexpr bool is_normal() const {
     return is_finite() && !is_subnormal();
   }
+
+  // Modifiers
+  LIBC_INLINE constexpr void next_toward_inf() {
----------------
legrosbuffle wrote:

In that case it probably makes more sense to return by value ?

IIUC, this would look like:
```
const FPRep input = ...;
return cond ? input : input.next_toward_inf()
```

instead of 

```
FPRep input = ...;
if (cond) {
   input.next_toward_inf();
}
return input;
```


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


More information about the libc-commits mailing list