Commit 491f46f
committed
Speed up hts_parse_decimal() handling of oversized exponents
The loop to apply exponent values could be made to run for a
very long time (although not forever) if the exponent value
in the number passed to the function was very large. As in
both the +ve and -ve exponent cases this will eventually
result in `n` becoming zero (the former through overflow),
it's possible to short-cut the rest of the loop as the final
value will no longer change.
Note that this does not try to add overflow detection, which
would require more extensive changes and is left to future
work.
Signed-off-by: Rob Davies <rmd+git@sanger.ac.uk>1 parent 942f3be commit 491f46f
2 files changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3923 | 3923 | | |
3924 | 3924 | | |
3925 | 3925 | | |
3926 | | - | |
3927 | | - | |
| 3926 | + | |
| 3927 | + | |
3928 | 3928 | | |
3929 | 3929 | | |
3930 | 3930 | | |
| |||
0 commit comments