Skip to content

Conversation

ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Sep 23, 2025

Changes:

  • Implemented atoi, atol, strtol, strtoul, strtoll, strtoull in assembly.
  • Optimized llmulu_b
CC per decimal digit
atoi    :  21F +  4R +  3W +  1
atol    :  32F +  4R +  3W +  1
strtol  :  79F + 13R + 12W + 21
strtoll : 106F + 20R + 18W + 37 (over-estimate of the average CC)

atoi, and atol, now have their own dedicated routines which offer a good performance boost compared to wrapping strtol. This is because they don't need to track endptr or overflow, and they only work with base 10.

A dedicated routine for atoll wouldn't be much faster than strtoll since the main bottle neck is multiplication.

@ZERICO2005 ZERICO2005 marked this pull request as ready for review September 27, 2025 03:55
@ZERICO2005 ZERICO2005 changed the title implemented atoi, atol, and atoll in assembly implemented atoi, atol, and strto(u)l(l) in assembly Sep 30, 2025
Comment on lines 178 to 180
ld bc, 0
ld de, 0
ld hl, 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot to optimize this lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant