[llvm] [libc] [libc] Add more functions in CPP/bit.h (PR #73814)
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 09:18:29 PST 2023
================
@@ -36,41 +36,53 @@ template <> class numeric_limits<int> {
public:
LIBC_INLINE static constexpr int max() { return INT_MAX; }
LIBC_INLINE static constexpr int min() { return INT_MIN; }
+ LIBC_INLINE_VAR static constexpr int digits = CHAR_BIT * sizeof(int) - 1;
----------------
legrosbuffle wrote:
Refactor all these to a `consteval int digits_for<T>()` ? Or maybe even:
```
template <> class numeric_limits<int> : public numeric_limits_impl<int, INT_MAX, INT_MIN> {};
```
and derive everything in `numeric_limits_impl` ?
https://github.com/llvm/llvm-project/pull/73814
More information about the llvm-commits
mailing list