From bb728a572a0684df8b7f0bd12dcf551f7ba97443 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 18 Oct 2019 07:43:46 -0700 Subject: [PATCH] packed_arg_bitsize -> packed_arg_bits and remove packed_arg_mask --- include/fmt/core.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 1eae83e5..993ca468 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -893,12 +893,9 @@ using mapped_type_constant = type_constant().map(std::declval())), typename Context::char_type>; +enum { packed_arg_bits = 5 }; // Maximum number of arguments with packed types. -enum { - packed_arg_bitsize = 5, - packed_arg_mask = (1 << packed_arg_bitsize) - 1, - max_packed_args = 63 / packed_arg_bitsize, -}; +enum { max_packed_args = 63 / packed_arg_bits }; enum : unsigned long long { is_unpacked_bit = 1ull << 63 }; template class arg_map; @@ -1063,7 +1060,7 @@ template constexpr unsigned long long encode_types() { return 0; } template constexpr unsigned long long encode_types() { return mapped_type_constant::value | - (encode_types() << packed_arg_bitsize); + (encode_types() << packed_arg_bits); } template @@ -1208,9 +1205,9 @@ template class basic_format_args { bool is_packed() const { return (types_ & internal::is_unpacked_bit) == 0; } internal::type type(int index) const { - int shift = index * internal::packed_arg_bitsize; - return static_cast((types_ >> shift) & - internal::packed_arg_mask); + int shift = index * internal::packed_arg_bits; + int mask = (1 << internal::packed_arg_bits) - 1; + return static_cast((types_ >> shift) & mask); } friend class internal::arg_map;