[llvm] [ADT] Replace Min with variadic std::min (PR #157390)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 8 10:24:13 PDT 2025
================
@@ -226,19 +227,13 @@ struct PointerSumTypeHelper : MemberTs... {
};
// Next we need to compute the number of bits available for the discriminant
- // by taking the min of the bits available for each member. Much of this
- // would be amazingly easier with good constexpr support.
- template <uintptr_t V, uintptr_t... Vs>
- struct Min : std::integral_constant<
- uintptr_t, (V < Min<Vs...>::value ? V : Min<Vs...>::value)> {
- };
- template <uintptr_t V>
- struct Min<V> : std::integral_constant<uintptr_t, V> {};
- enum { NumTagBits = Min<MemberTs::TraitsT::NumLowBitsAvailable...>::value };
+ // by taking the min of the bits available for each member.
+ static constexpr int NumTagBits =
----------------
kazutakahirata wrote:
@kuhar I think `int` is slightly better because `NumLowBitsAvailable` is declared pretty consistently as `int` across the codebase.
https://github.com/llvm/llvm-project/pull/157390
More information about the llvm-commits
mailing list