mirror of
https://github.com/boostorg/json.git
synced 2026-01-24 18:02:22 +00:00
Fix parse_unsigned
This commit is contained in:
committed by
Vinnie Falco
parent
49d5f18d82
commit
2bb3c39865
@@ -126,13 +126,13 @@ inline std::size_t count_digits( char const* p ) noexcept
|
||||
{
|
||||
std::size_t n = 0;
|
||||
|
||||
for( ; n < 16; ++n )
|
||||
for( ; n < 16; ++n )
|
||||
{
|
||||
unsigned char const d = *p++ - '0';
|
||||
if(d > 9) break;
|
||||
}
|
||||
|
||||
return n;
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -144,6 +144,8 @@ inline uint64_t parse_unsigned( uint64_t r, char const * p, std::size_t n ) noex
|
||||
uint32_t v;
|
||||
memcpy( &v, p, 4 );
|
||||
|
||||
v -= 0x30303030;
|
||||
|
||||
unsigned w0 = v & 0xFF;
|
||||
unsigned w1 = (v >> 8) & 0xFF;
|
||||
unsigned w2 = (v >> 16) & 0xFF;
|
||||
|
||||
Reference in New Issue
Block a user