@@ -927,12 +927,12 @@ class add_thousands_sep {
927
927
explicit add_thousands_sep (basic_string_view<Char> sep)
928
928
: sep_(sep), digit_index_(0 ) {}
929
929
930
- void operator ()(Char *&buffer ) {
930
+ void operator ()(Char *&buf ) {
931
931
if (++digit_index_ % 3 != 0 )
932
932
return ;
933
- buffer -= sep_.size ();
933
+ buf -= sep_.size ();
934
934
std::uninitialized_copy (sep_.data (), sep_.data () + sep_.size (),
935
- internal::make_checked (buffer , sep_.size ()));
935
+ internal::make_checked (buf , sep_.size ()));
936
936
}
937
937
938
938
enum { size = 1 };
@@ -955,74 +955,74 @@ inline wchar_t thousands_sep(locale_ref loc) {
955
955
// thousands_sep is a functor that is called after writing each char to
956
956
// add a thousands separator if necessary.
957
957
template <typename UInt, typename Char, typename ThousandsSep>
958
- inline Char *format_decimal (Char *buffer , UInt value, int num_digits,
958
+ inline Char *format_decimal (Char *buf , UInt value, int num_digits,
959
959
ThousandsSep thousands_sep) {
960
960
FMT_ASSERT (num_digits >= 0 , " invalid digit count" );
961
- buffer += num_digits;
962
- Char *end = buffer ;
961
+ buf += num_digits;
962
+ Char *end = buf ;
963
963
while (value >= 100 ) {
964
964
// Integer division is slow so do it for a group of two digits instead
965
965
// of for every digit. The idea comes from the talk by Alexandrescu
966
966
// "Three Optimization Tips for C++". See speed-test for a comparison.
967
967
unsigned index = static_cast <unsigned >((value % 100 ) * 2 );
968
968
value /= 100 ;
969
- *--buffer = static_cast <Char>(data::DIGITS[index + 1 ]);
970
- thousands_sep (buffer );
971
- *--buffer = static_cast <Char>(data::DIGITS[index ]);
972
- thousands_sep (buffer );
969
+ *--buf = static_cast <Char>(data::DIGITS[index + 1 ]);
970
+ thousands_sep (buf );
971
+ *--buf = static_cast <Char>(data::DIGITS[index ]);
972
+ thousands_sep (buf );
973
973
}
974
974
if (value < 10 ) {
975
- *--buffer = static_cast <Char>(' 0' + value);
975
+ *--buf = static_cast <Char>(' 0' + value);
976
976
return end;
977
977
}
978
978
unsigned index = static_cast <unsigned >(value * 2 );
979
- *--buffer = static_cast <Char>(data::DIGITS[index + 1 ]);
980
- thousands_sep (buffer );
981
- *--buffer = static_cast <Char>(data::DIGITS[index ]);
979
+ *--buf = static_cast <Char>(data::DIGITS[index + 1 ]);
980
+ thousands_sep (buf );
981
+ *--buf = static_cast <Char>(data::DIGITS[index ]);
982
982
return end;
983
983
}
984
984
985
985
template <typename OutChar, typename UInt, typename Iterator,
986
986
typename ThousandsSep>
987
987
inline Iterator format_decimal (
988
- Iterator out , UInt value, int num_digits, ThousandsSep sep) {
988
+ Iterator out_it , UInt value, int num_digits, ThousandsSep sep) {
989
989
FMT_ASSERT (num_digits >= 0 , " invalid digit count" );
990
990
typedef typename ThousandsSep::char_type char_type;
991
991
// Buffer should be large enough to hold all digits (<= digits10 + 1).
992
992
enum { max_size = std::numeric_limits<UInt>::digits10 + 1 };
993
993
FMT_ASSERT (ThousandsSep::size <= 1 , " invalid separator" );
994
- char_type buffer [max_size + max_size / 3 ];
995
- auto end = format_decimal (buffer , value, num_digits, sep);
996
- return internal::copy_str<OutChar>(buffer , end, out );
994
+ char_type buf [max_size + max_size / 3 ];
995
+ auto end = format_decimal (buf , value, num_digits, sep);
996
+ return internal::copy_str<OutChar>(buf , end, out_it );
997
997
}
998
998
999
999
template <typename OutChar, typename It, typename UInt>
1000
- inline It format_decimal (It out , UInt value, int num_digits) {
1001
- return format_decimal<OutChar>(out , value, num_digits, no_thousands_sep ());
1000
+ inline It format_decimal (It out_it , UInt value, int num_digits) {
1001
+ return format_decimal<OutChar>(out_it , value, num_digits, no_thousands_sep ());
1002
1002
}
1003
1003
1004
1004
template <unsigned BASE_BITS, typename Char, typename UInt>
1005
- inline Char *format_uint (Char *buffer , UInt value, int num_digits,
1005
+ inline Char *format_uint (Char *buf , UInt value, int num_digits,
1006
1006
bool upper = false ) {
1007
- buffer += num_digits;
1008
- Char *end = buffer ;
1007
+ buf += num_digits;
1008
+ Char *end = buf ;
1009
1009
do {
1010
1010
const char *digits = upper ? " 0123456789ABCDEF" : " 0123456789abcdef" ;
1011
1011
unsigned digit = (value & ((1 << BASE_BITS) - 1 ));
1012
- *--buffer = static_cast <Char>(BASE_BITS < 4 ? static_cast <char >(' 0' + digit)
1012
+ *--buf = static_cast <Char>(BASE_BITS < 4 ? static_cast <char >(' 0' + digit)
1013
1013
: digits[digit]);
1014
1014
} while ((value >>= BASE_BITS) != 0 );
1015
1015
return end;
1016
1016
}
1017
1017
1018
1018
template <unsigned BASE_BITS, typename Char, typename It, typename UInt>
1019
- inline It format_uint (It out , UInt value, int num_digits,
1019
+ inline It format_uint (It out_it , UInt value, int num_digits,
1020
1020
bool upper = false ) {
1021
1021
// Buffer should be large enough to hold all digits (digits / BASE_BITS + 1)
1022
1022
// and null.
1023
- char buffer [std::numeric_limits<UInt>::digits / BASE_BITS + 2 ];
1024
- format_uint<BASE_BITS>(buffer , value, num_digits, upper);
1025
- return internal::copy_str<Char>(buffer, buffer + num_digits, out );
1023
+ char buf [std::numeric_limits<UInt>::digits / BASE_BITS + 2 ];
1024
+ format_uint<BASE_BITS>(buf , value, num_digits, upper);
1025
+ return internal::copy_str<Char>(buf, buf + num_digits, out_it );
1026
1026
}
1027
1027
1028
1028
#ifndef _WIN32
0 commit comments