Simplifying function call.
This commit is contained in:
parent
858426c874
commit
c1de7662c1
|
@ -150,9 +150,9 @@ static inline uint32_t parse_eight_digits_unrolled(const char *chars) {
|
|||
// Note: a redesign could avoid this function entirely.
|
||||
//
|
||||
static never_inline bool
|
||||
parse_highprecision_float(const u8 *const buf, UNUSED size_t len,
|
||||
ParsedJson &pj, UNUSED const u32 depth, const u32 offset,
|
||||
UNUSED bool found_zero, bool found_minus) {
|
||||
parse_highprecision_float(const u8 *const buf,
|
||||
ParsedJson &pj, const u32 offset,
|
||||
bool found_minus) {
|
||||
const char *p = (const char *)(buf + offset);
|
||||
|
||||
bool negative = false;
|
||||
|
@ -270,9 +270,8 @@ parse_highprecision_float(const u8 *const buf, UNUSED size_t len,
|
|||
// This function will almost never be called!!!
|
||||
//
|
||||
static never_inline bool parse_large_integer(const u8 *const buf,
|
||||
UNUSED size_t len, ParsedJson &pj,
|
||||
UNUSED const u32 depth, const u32 offset,
|
||||
UNUSED bool found_zero,
|
||||
ParsedJson &pj,
|
||||
const u32 offset,
|
||||
bool found_minus) {
|
||||
const char *p = (const char *)(buf + offset);
|
||||
|
||||
|
@ -345,9 +344,9 @@ static never_inline bool parse_large_integer(const u8 *const buf,
|
|||
|
||||
// parse the number at buf + offset
|
||||
// define JSON_TEST_NUMBERS for unit testing
|
||||
static really_inline bool parse_number(const u8 *const buf, UNUSED size_t len,
|
||||
ParsedJson &pj, UNUSED const u32 depth,
|
||||
const u32 offset, UNUSED bool found_zero,
|
||||
static really_inline bool parse_number(const u8 *const buf,
|
||||
ParsedJson &pj,
|
||||
const u32 offset,
|
||||
bool found_minus) {
|
||||
const char *p = (const char *)(buf + offset);
|
||||
bool negative = false;
|
||||
|
@ -464,7 +463,7 @@ static really_inline bool parse_number(const u8 *const buf, UNUSED size_t len,
|
|||
if (unlikely(digitcount >= 19)) { // this is uncommon!!!
|
||||
// this is almost never going to get called!!!
|
||||
// we start anew, going slowly!!!
|
||||
return parse_highprecision_float(buf, len, pj, depth, offset, found_zero,
|
||||
return parse_highprecision_float(buf, pj, offset,
|
||||
found_minus);
|
||||
}
|
||||
///////////
|
||||
|
@ -493,7 +492,7 @@ static really_inline bool parse_number(const u8 *const buf, UNUSED size_t len,
|
|||
}
|
||||
} else {
|
||||
if (unlikely(digitcount >= 19)) { // this is uncommon!!!
|
||||
return parse_large_integer(buf, len, pj, depth, offset, found_zero,
|
||||
return parse_large_integer(buf, pj, offset,
|
||||
found_minus);
|
||||
}
|
||||
pj.write_tape_s64(i);
|
||||
|
|
|
@ -140,13 +140,7 @@ bool unified_machine(const u8 *buf, size_t len, ParsedJson &pj) {
|
|||
}
|
||||
pj.write_tape(0, c);
|
||||
break;
|
||||
case '0': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, true, false)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
|
@ -156,13 +150,13 @@ bool unified_machine(const u8 *buf, size_t len, ParsedJson &pj) {
|
|||
case '7':
|
||||
case '8':
|
||||
case '9': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, false)) {
|
||||
if (!parse_number(buf, pj, idx, false)) {
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '-': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, true)) {
|
||||
if (!parse_number(buf, pj, idx, true)) {
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
@ -238,12 +232,7 @@ object_key_state:
|
|||
}
|
||||
pj.write_tape(0, c);
|
||||
break;
|
||||
case '0': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, true, false)) {
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
|
@ -253,13 +242,13 @@ object_key_state:
|
|||
case '7':
|
||||
case '8':
|
||||
case '9': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, false)) {
|
||||
if (!parse_number(buf, pj, idx, false)) {
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '-': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, true)) {
|
||||
if (!parse_number(buf, pj, idx, true)) {
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
@ -360,12 +349,7 @@ main_array_switch:
|
|||
pj.write_tape(0, c);
|
||||
break; // goto array_continue;
|
||||
|
||||
case '0': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, true, false)) {
|
||||
goto fail;
|
||||
}
|
||||
break; // goto array_continue;
|
||||
}
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
|
@ -375,13 +359,13 @@ main_array_switch:
|
|||
case '7':
|
||||
case '8':
|
||||
case '9': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, false)) {
|
||||
if (!parse_number(buf, pj, idx, false)) {
|
||||
goto fail;
|
||||
}
|
||||
break; // goto array_continue;
|
||||
}
|
||||
case '-': {
|
||||
if (!parse_number(buf, len, pj, depth, idx, false, true)) {
|
||||
if (!parse_number(buf, pj, idx, true)) {
|
||||
goto fail;
|
||||
}
|
||||
break; // goto array_continue;
|
||||
|
|
Loading…
Reference in New Issue