Skip to content

strconv : Addition of Atoi8/16/32/64 helper, with their test.#23757

Merged
spytheman merged 4 commits into
vlang:masterfrom
Bruno-Vdr:master
Feb 19, 2025
Merged

strconv : Addition of Atoi8/16/32/64 helper, with their test.#23757
spytheman merged 4 commits into
vlang:masterfrom
Bruno-Vdr:master

Conversation

@Bruno-Vdr

Copy link
Copy Markdown
Contributor

Added atoi8, atoi16, atoi32 and atoi64 method. Added respective tests.Refactor some atoi() code to avoid code duplication. atoi64() uses a slightly different code, to keep using i64 types. Spytheman suggested to use math.i128 aritmetic. I didn't do it, but this can be done by anyone else.
I didn' t replicate Spytheman' s work around for MSVC compiler (msvc has a bug that treats just i64(min_int) as 2147483648).

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22172

Comment thread vlib/strconv/atoi_test.v Outdated
Comment thread vlib/strconv/atoi.v Outdated

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit a694918 into vlang:master Feb 19, 2025
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.

3 participants