[llvm] Use std::is_unsigned instead of std::numeric_limits (NFC)
This commit is contained in:
		
							parent
							
								
									c63f823875
								
							
						
					
					
						commit
						ec8605ff52
					
				| 
						 | 
				
			
			@ -84,8 +84,7 @@ template<typename ValueT,
 | 
			
		|||
         typename KeyFunctorT = identity<unsigned>,
 | 
			
		||||
         typename SparseT = uint8_t>
 | 
			
		||||
class SparseMultiSet {
 | 
			
		||||
  static_assert(std::numeric_limits<SparseT>::is_integer &&
 | 
			
		||||
                !std::numeric_limits<SparseT>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<SparseT>,
 | 
			
		||||
                "SparseT must be an unsigned integer type");
 | 
			
		||||
 | 
			
		||||
  /// The actual data that's stored, as a doubly-linked list implemented via
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,8 +122,7 @@ template<typename ValueT,
 | 
			
		|||
         typename KeyFunctorT = identity<unsigned>,
 | 
			
		||||
         typename SparseT = uint8_t>
 | 
			
		||||
class SparseSet {
 | 
			
		||||
  static_assert(std::numeric_limits<SparseT>::is_integer &&
 | 
			
		||||
                !std::numeric_limits<SparseT>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<SparseT>,
 | 
			
		||||
                "SparseT must be an unsigned integer type");
 | 
			
		||||
 | 
			
		||||
  using KeyT = typename KeyFunctorT::argument_type;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -151,8 +151,7 @@ template <typename T> struct TrailingZerosCounter<T, 8> {
 | 
			
		|||
///   valid arguments.
 | 
			
		||||
template <typename T>
 | 
			
		||||
unsigned countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
 | 
			
		||||
  static_assert(std::numeric_limits<T>::is_integer &&
 | 
			
		||||
                    !std::numeric_limits<T>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<T>,
 | 
			
		||||
                "Only unsigned integral types are allowed.");
 | 
			
		||||
  return llvm::detail::TrailingZerosCounter<T, sizeof(T)>::count(Val, ZB);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -220,8 +219,7 @@ template <typename T> struct LeadingZerosCounter<T, 8> {
 | 
			
		|||
///   valid arguments.
 | 
			
		||||
template <typename T>
 | 
			
		||||
unsigned countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
 | 
			
		||||
  static_assert(std::numeric_limits<T>::is_integer &&
 | 
			
		||||
                    !std::numeric_limits<T>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<T>,
 | 
			
		||||
                "Only unsigned integral types are allowed.");
 | 
			
		||||
  return llvm::detail::LeadingZerosCounter<T, sizeof(T)>::count(Val, ZB);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -504,8 +502,7 @@ constexpr inline bool isPowerOf2_64(uint64_t Value) {
 | 
			
		|||
/// ZB_Undefined are valid arguments.
 | 
			
		||||
template <typename T>
 | 
			
		||||
unsigned countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
 | 
			
		||||
  static_assert(std::numeric_limits<T>::is_integer &&
 | 
			
		||||
                    !std::numeric_limits<T>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<T>,
 | 
			
		||||
                "Only unsigned integral types are allowed.");
 | 
			
		||||
  return countLeadingZeros<T>(~Value, ZB);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -520,8 +517,7 @@ unsigned countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
 | 
			
		|||
/// ZB_Undefined are valid arguments.
 | 
			
		||||
template <typename T>
 | 
			
		||||
unsigned countTrailingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
 | 
			
		||||
  static_assert(std::numeric_limits<T>::is_integer &&
 | 
			
		||||
                    !std::numeric_limits<T>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<T>,
 | 
			
		||||
                "Only unsigned integral types are allowed.");
 | 
			
		||||
  return countTrailingZeros<T>(~Value, ZB);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -531,8 +527,7 @@ unsigned countTrailingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
 | 
			
		|||
/// Returns 0 if the word is zero.
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline unsigned countPopulation(T Value) {
 | 
			
		||||
  static_assert(std::numeric_limits<T>::is_integer &&
 | 
			
		||||
                    !std::numeric_limits<T>::is_signed,
 | 
			
		||||
  static_assert(std::is_unsigned_v<T>,
 | 
			
		||||
                "Only unsigned integral types are allowed.");
 | 
			
		||||
  return (unsigned)llvm::popcount(Value);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue