File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -591,6 +591,22 @@ json_eat_comments(JSON_ParserState *state)
591591static inline void
592592json_eat_whitespace (JSON_ParserState * state )
593593{
594+ #if defined(__BYTE_ORDER__ ) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
595+ // Heuristic: if we see a newline, there may be consecutive of spaces after it.
596+ if (RB_UNLIKELY (state -> cursor < state -> end && * state -> cursor == '\n' )) {
597+ state -> cursor ++ ;
598+
599+ while (state -> cursor + sizeof (uint64_t ) <= state -> end ) {
600+ uint64_t chunk ;
601+ memcpy (& chunk , state -> cursor , sizeof (uint64_t ));
602+ if (chunk != 0x2020202020202020 ) {
603+ break ;
604+ }
605+ state -> cursor += sizeof (uint64_t );
606+ }
607+ }
608+ #endif
609+
594610 while (state -> cursor < state -> end && RB_UNLIKELY (whitespace [(unsigned char )* state -> cursor ])) {
595611 if (RB_LIKELY (* state -> cursor != '/' )) {
596612 state -> cursor ++ ;
You can’t perform that action at this time.
0 commit comments