Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 8/16-bit integer support to SimpleAtoi #1762

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xERIC
Copy link

@0xERIC 0xERIC commented Sep 26, 2024

This makes SimpleAtoi more ergonomic for tasks like parsing port numbers. These changes were mostly trivial copies of existing code paths. Two spots worth looking more closely at are:

  • The signed-ness check (kIsSigned) which didn't work properly for these new narrower types, and has been updated.
  • The change from a boolean for type width, to the value of the width (kUse64Bit vs kIntTypeSize).

A bit of previous discussion was here. Even if these changes aren't merged via this PR, I'd love for this to expedite the process of getting them made internally.

The current check fails for narrow types (e.g. uint16_t) because of
integer promotion. This change fixes the check for more types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant