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

via libc-commits libc-commits at lists.llvm.org
Wed Dec 6 12:57:49 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 {
----------------
michaelrj-google wrote:

does this template need any sort of limit (e.g. `enable_if_t<is_integral_v<T>>`)?

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


More information about the libc-commits mailing list