mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-29 12:32:38 +00:00
Improve code_point_length codegen on older gcc
This commit is contained in:
parent
aeee70a815
commit
a58c133821
@ -94,7 +94,7 @@
|
|||||||
# define FMT_CONSTEXPR_DECL
|
# define FMT_CONSTEXPR_DECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((__cplusplus >= 202002L) && \
|
#if ((__cplusplus >= 202002L) && \
|
||||||
(!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE > 9)) || \
|
(!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE > 9)) || \
|
||||||
(__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
|
(__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
|
||||||
# define FMT_CONSTEXPR20 constexpr
|
# define FMT_CONSTEXPR20 constexpr
|
||||||
@ -2140,8 +2140,8 @@ constexpr auto to_ascii(Char value) ->
|
|||||||
template <typename Char>
|
template <typename Char>
|
||||||
FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int {
|
FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int {
|
||||||
if (const_check(sizeof(Char) != 1)) return 1;
|
if (const_check(sizeof(Char) != 1)) return 1;
|
||||||
constexpr char lengths[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
auto lengths =
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0};
|
"\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\2\2\2\2\3\3\4";
|
||||||
int len = lengths[static_cast<unsigned char>(*begin) >> 3];
|
int len = lengths[static_cast<unsigned char>(*begin) >> 3];
|
||||||
|
|
||||||
// Compute the pointer to the next character early so that the next
|
// Compute the pointer to the next character early so that the next
|
||||||
|
Loading…
x
Reference in New Issue
Block a user