From: Kazu Hirata Date: Mon, 29 Aug 2022 00:35:06 +0000 (-0700) Subject: [llvm] Use std::is_unsigned instead of std::numeric_limits (NFC) X-Git-Tag: upstream/17.0.6~35112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec8605ff5296f835e148be11f86a7698b4736757;p=platform%2Fupstream%2Fllvm.git [llvm] Use std::is_unsigned instead of std::numeric_limits (NFC) --- diff --git a/llvm/include/llvm/ADT/SparseMultiSet.h b/llvm/include/llvm/ADT/SparseMultiSet.h index ef2a5ea..d8dbe40 100644 --- a/llvm/include/llvm/ADT/SparseMultiSet.h +++ b/llvm/include/llvm/ADT/SparseMultiSet.h @@ -84,8 +84,7 @@ template, typename SparseT = uint8_t> class SparseMultiSet { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "SparseT must be an unsigned integer type"); /// The actual data that's stored, as a doubly-linked list implemented via diff --git a/llvm/include/llvm/ADT/SparseSet.h b/llvm/include/llvm/ADT/SparseSet.h index 5c7087b..c9895d7 100644 --- a/llvm/include/llvm/ADT/SparseSet.h +++ b/llvm/include/llvm/ADT/SparseSet.h @@ -122,8 +122,7 @@ template, typename SparseT = uint8_t> class SparseSet { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "SparseT must be an unsigned integer type"); using KeyT = typename KeyFunctorT::argument_type; diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index ca3e7b9..c318ec6 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -151,8 +151,7 @@ template struct TrailingZerosCounter { /// valid arguments. template unsigned countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "Only unsigned integral types are allowed."); return llvm::detail::TrailingZerosCounter::count(Val, ZB); } @@ -220,8 +219,7 @@ template struct LeadingZerosCounter { /// valid arguments. template unsigned countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "Only unsigned integral types are allowed."); return llvm::detail::LeadingZerosCounter::count(Val, ZB); } @@ -504,8 +502,7 @@ constexpr inline bool isPowerOf2_64(uint64_t Value) { /// ZB_Undefined are valid arguments. template unsigned countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "Only unsigned integral types are allowed."); return countLeadingZeros(~Value, ZB); } @@ -520,8 +517,7 @@ unsigned countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) { /// ZB_Undefined are valid arguments. template unsigned countTrailingOnes(T Value, ZeroBehavior ZB = ZB_Width) { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "Only unsigned integral types are allowed."); return countTrailingZeros(~Value, ZB); } @@ -531,8 +527,7 @@ unsigned countTrailingOnes(T Value, ZeroBehavior ZB = ZB_Width) { /// Returns 0 if the word is zero. template inline unsigned countPopulation(T Value) { - static_assert(std::numeric_limits::is_integer && - !std::numeric_limits::is_signed, + static_assert(std::is_unsigned_v, "Only unsigned integral types are allowed."); return (unsigned)llvm::popcount(Value); }