@@ -323,7 +323,7 @@ typedef struct JSON_ParserStateStruct {
323323 int current_nesting ;
324324} JSON_ParserState ;
325325
326- static inline ssize_t rest (JSON_ParserState * state ) {
326+ static inline size_t rest (JSON_ParserState * state ) {
327327 return state -> end - state -> cursor ;
328328}
329329
@@ -525,7 +525,7 @@ json_eat_whitespace(JSON_ParserState *state)
525525 state -> cursor ++ ;
526526
527527 // Heuristic: if we see a newline, there is likely consecutive spaces after it.
528- #if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
528+ #if JSON_CPU_LITTLE_ENDIAN_64BITS
529529 while (rest (state ) > 8 ) {
530530 uint64_t chunk ;
531531 memcpy (& chunk , state -> cursor , sizeof (uint64_t ));
@@ -966,7 +966,7 @@ static inline VALUE json_parse_string(JSON_ParserState *state, JSON_ParserConfig
966966 return Qfalse ;
967967}
968968
969- #if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
969+ #if JSON_CPU_LITTLE_ENDIAN_64BITS
970970// From: https://lemire.me/blog/2022/01/21/swar-explained-parsing-eight-digits/
971971// Additional References:
972972// https://johnnylee-sde.github.io/Fast-numeric-string-to-int/
@@ -995,8 +995,8 @@ static inline int json_parse_digits(JSON_ParserState *state, uint64_t *accumulat
995995{
996996 const char * start = state -> cursor ;
997997
998- #if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
999- while (rest (state ) >= 8 ) {
998+ #if JSON_CPU_LITTLE_ENDIAN_64BITS
999+ while (rest (state ) >= sizeof ( uint64_t ) ) {
10001000 uint64_t next_8bytes ;
10011001 memcpy (& next_8bytes , state -> cursor , sizeof (uint64_t ));
10021002
0 commit comments