[libcxx-commits] [PATCH] D102328: [libc++] Fix __bitop_unsigned_integer, rename to __is_unsigned_integer, and fix constexprness of std::countr_zero(__uint128_t)

Jonathan Wakely via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 12 13:08:05 PDT 2021


jwakely added a comment.

FWIW



================
Comment at: libcxx/include/bit:84
 {
-    static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotl requires unsigned");
+    static_assert(is_unsigned<_Tp>::value, "__rotl requires an unsigned integer type");
     const unsigned int __dig = numeric_limits<_Tp>::digits;
----------------
Quuxplusone wrote:
> I relaxed the static_assert on the internal functions for the same (bad) intuitive reason that the internal functions are provided in the first place. We never actually //use// any of these internal functions, but //if we did//, it might be nice to be able to use them on, I dunno, `char` or something. I'm highly ambivalent about whether we should be asserting anything at all, or if we do, what it should be. So I'll take suggestions if anyone's got any.
FWIW libstdc++ has similar internal versions of these functions, available from C++14 up, and I didn't constrain them or add assertions. The public functions are responsible for input validation (if needed) and the internal functions assume the caller knows what they're doing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102328



More information about the libcxx-commits mailing list