File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ macro_rules! expect_string {
134134
135135 loop {
136136 let ch = next_byte!( $parser) ;
137- let code = CHARCODES [ ch as usize ] ;
138- if code == 0 {
137+ if CHARCODES [ ch as usize ] == 0 {
139138 continue ;
140139 }
141140 if ch == b'"' {
@@ -381,8 +380,7 @@ impl<'a> Parser<'a> {
381380 buffer. extend_from_slice ( self . source [ start .. self . index - 1 ] . as_bytes ( ) ) ;
382381
383382 loop {
384- let code = CHARCODES [ ch as usize ] ;
385- if code == 0 {
383+ if CHARCODES [ ch as usize ] == 0 {
386384 buffer. push ( ch) ;
387385 ch = next_byte ! ( self ) ;
388386 continue ;
@@ -434,10 +432,10 @@ impl<'a> Parser<'a> {
434432
435433 loop {
436434 // Avoid overflow, switch to operating on f64
437- if p ! = 10000000000000000000 {
435+ if p = = 10000000000000000000 {
438436 num += ( f as f64 ) / ( p as f64 ) ;
439437
440- let mut p = 0.1 ;
438+ let mut p = 1e-19 ;
441439
442440 read_num ! ( self , digit, {
443441 num += ( digit as f64 ) * p;
@@ -447,20 +445,22 @@ impl<'a> Parser<'a> {
447445 }
448446
449447 // Carry on with u64
450- let ch = next_byte ! ( self || break ) ;
448+ let ch = next_byte ! ( self || {
449+ num += ( f as f64 ) / ( p as f64 ) ;
450+ break ;
451+ } ) ;
451452 match ch {
452453 b'0' ... b'9' => {
453454 f = ( f << 1 ) + ( f << 3 ) + ( ch - b'0' ) as u64 ;
454455 p = ( p << 1 ) + ( p << 3 ) ;
455456 } ,
456457 _ => {
457458 self . index -= 1 ;
459+ num += ( f as f64 ) / ( p as f64 ) ;
458460 break ;
459461 }
460462 }
461463 }
462-
463- num += ( f as f64 ) / ( p as f64 ) ;
464464 } else {
465465 self . index -= 1 ;
466466 }
You can’t perform that action at this time.
0 commit comments