diff --git a/src/ds/bits.h b/src/ds/bits.h index 3f0283c..ba96b45 100644 --- a/src/ds/bits.h +++ b/src/ds/bits.h @@ -87,9 +87,13 @@ namespace snmalloc /** * Returns a value of type T that has a single bit set, + * + * S is a template parameter because callers use either `int` or `size_t` + * and either is valid to represent a number in the range 0-63 (or 0-127 if + * we want to use `__uint128_t` as `T`). */ - template - constexpr T one_at_bit(size_t shift) + template + constexpr T one_at_bit(S shift) { static_assert(std::is_integral_v, "Type must be integral"); return (static_cast(1)) << shift;