Switch to a simple native int parser #16835

pull sipa wants to merge 2 commits into bitcoin:master from sipa:201909_simpleparseint changing 3 files +44 −58
  1. sipa commented at 5:47 PM on September 9, 2019: member

    I noticed that the Parse[U]Int* functions are written in a very convoluted way (deferring to strto[u][l]l, and having checks for weird characters to avoid locale-dependent behaviour, and range checking due to type mismatch). This PR changes them to instead just use a simple native int parser. This should be simpler to review for correctness. It's likely faster too, though that's not a goal.

    No worries if people don't feel like touching this code.

  2. Add additional edge case tests for int parsing d74e18643b
  3. Simple native locale-indepent int parser 99e941e10d
  4. sipa commented at 6:52 PM on September 9, 2019: member

    This isn't as easy as I hoped because ubsan correctly points out I'm relying on signed overflow. Closing until I have a more correct idea.

  5. sipa closed this on Sep 9, 2019

  6. DrahtBot locked this on Dec 16, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me