[libc-commits] [libc] [libc] fix -Wshift-count-overflow in UInt.h (PR #74649)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Dec 7 08:20:44 PST 2023


================
@@ -103,13 +103,20 @@ template <size_t Bits, bool Signed> struct BigInt {
       val[i] = words[i];
   }
 
-  template <typename T, typename = cpp::enable_if_t<cpp::is_integral_v<T> &&
-                                                    sizeof(T) <= 16 &&
-                                                    !cpp::is_same_v<T, bool>>>
-  LIBC_INLINE constexpr explicit operator T() const {
-    if constexpr (sizeof(T) <= 8)
-      return static_cast<T>(val[0]);
+  template <typename T> LIBC_INLINE constexpr explicit operator T() const {
----------------
nickdesaulniers wrote:

yeah, if it doesn't fail here it will fail there.  I don't feel strongly either way, so merging for now.  If you feel strongly otherwise I'll send another patch to add that.

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


More information about the libc-commits mailing list