Commit e3ebf366 authored by Victor Zverovich's avatar Victor Zverovich

Inline padding shifts

parent 894faf3f
...@@ -150,9 +150,6 @@ template <typename T> constexpr const char basic_data<T>::digits[][2]; ...@@ -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>::hex_digits[];
template <typename T> constexpr const char basic_data<T>::signs[]; 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 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 #endif
template <typename T> struct bits { template <typename T> struct bits {
......
...@@ -916,10 +916,6 @@ template <typename T = void> struct basic_data { ...@@ -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 char signs[4] = {0, '-', '+', ' '};
FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
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 #ifdef FMT_SHARED
...@@ -1328,8 +1324,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out, ...@@ -1328,8 +1324,7 @@ FMT_CONSTEXPR auto write_padded(OutputIt out,
static_assert(align == align::left || align == align::right, ""); static_assert(align == align::left || align == align::right, "");
unsigned spec_width = to_unsigned(specs.width); unsigned spec_width = to_unsigned(specs.width);
size_t padding = spec_width > width ? spec_width - width : 0; size_t padding = spec_width > width ? spec_width - width : 0;
auto* shifts = align == align::left ? data::left_padding_shifts auto* shifts = align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01";
: data::right_padding_shifts;
size_t left_padding = padding >> shifts[specs.align]; size_t left_padding = padding >> shifts[specs.align];
size_t right_padding = padding - left_padding; size_t right_padding = padding - left_padding;
auto it = reserve(out, size + padding * specs.fill.size()); auto it = reserve(out, size + padding * specs.fill.size());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment