Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Nov 15, 2023
1 parent 82e3811 commit 88c62cc
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions include/boost/json/detail/sse2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,34 @@ inline int count_digits( char const* p ) noexcept

inline uint64_t parse_unsigned( uint64_t r, char const * p, std::size_t n ) noexcept
{
constexpr int N = 4;
auto const e = p + n;
for( ; (e - p) >= N; p += N )
while( n >= 4 )
{
for( auto i = 0; i < N; ++i )
r = r * 10 + p[i] - '0';
}
r = r * 10 + p[0] - '0';
r = r * 10 + p[1] - '0';
r = r * 10 + p[2] - '0';
r = r * 10 + p[3] - '0';

for( ; p != e; ++p )
r = r * 10 + *p - '0';
p += 4;
n -= 4;
}

switch( n )
{
case 0:
break;
case 1:
r = r * 10 + p[0] - '0';
break;
case 2:
r = r * 10 + p[0] - '0';
r = r * 10 + p[1] - '0';
break;
case 3:
r = r * 10 + p[0] - '0';
r = r * 10 + p[1] - '0';
r = r * 10 + p[2] - '0';
break;
}
return r;
}

Expand Down

0 comments on commit 88c62cc

Please sign in to comment.