Skip to content

Commit

Permalink
Improve code_point_length codegen on older gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut authored and PoetaKodu committed Nov 11, 2021
1 parent 090727e commit 4fad7bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
# define FMT_CONSTEXPR_DECL
#endif

#if ((__cplusplus >= 202002L) && \
#if ((__cplusplus >= 202002L) && \
(!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE > 9)) || \
(__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
# define FMT_CONSTEXPR20 constexpr
Expand Down Expand Up @@ -2140,8 +2140,8 @@ constexpr auto to_ascii(Char value) ->
template <typename Char>
FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int {
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,
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0};
auto lengths =
"\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];

// Compute the pointer to the next character early so that the next
Expand Down

0 comments on commit 4fad7bf

Please sign in to comment.