mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-23 17:59:52 +00:00
Inline padding shifts
This commit is contained in:
parent
894faf3fed
commit
e3ebf366a6
@ -150,9 +150,6 @@ template <typename T> constexpr const char basic_data<T>::digits[][2];
|
||||
template <typename T> constexpr const char basic_data<T>::hex_digits[];
|
||||
template <typename T> constexpr const char basic_data<T>::signs[];
|
||||
template <typename T> constexpr const unsigned basic_data<T>::prefixes[];
|
||||
template <typename T> constexpr const char basic_data<T>::left_padding_shifts[];
|
||||
template <typename T>
|
||||
constexpr const char basic_data<T>::right_padding_shifts[];
|
||||
#endif
|
||||
|
||||
template <typename T> struct bits {
|
||||
|
@ -916,10 +916,6 @@ template <typename T = void> struct basic_data {
|
||||
FMT_API static constexpr const char signs[4] = {0, '-', '+', ' '};
|
||||
FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
|
||||
0x1000000u | ' '};
|
||||
FMT_API static constexpr const char left_padding_shifts[5] = {31, 31, 0, 1,
|
||||
0};
|
||||
FMT_API static constexpr const char right_padding_shifts[5] = {0, 31, 0, 1,
|
||||
0};
|
||||
};
|
||||
|
||||
#ifdef FMT_SHARED
|
||||
@ -1328,8 +1324,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out,
|
||||
static_assert(align == align::left || align == align::right, "");
|
||||
unsigned spec_width = to_unsigned(specs.width);
|
||||
size_t padding = spec_width > width ? spec_width - width : 0;
|
||||
auto* shifts = align == align::left ? data::left_padding_shifts
|
||||
: data::right_padding_shifts;
|
||||
auto* shifts = align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01";
|
||||
size_t left_padding = padding >> shifts[specs.align];
|
||||
size_t right_padding = padding - left_padding;
|
||||
auto it = reserve(out, size + padding * specs.fill.size());
|
||||
|
Loading…
Reference in New Issue
Block a user