Skip to content

Improvement of integer to text conversion#308

Open
Phidias618 wants to merge 1 commit into
chrismaltby:mainfrom
Phidias618:Int-to-text-conversion
Open

Improvement of integer to text conversion#308
Phidias618 wants to merge 1 commit into
chrismaltby:mainfrom
Phidias618:Int-to-text-conversion

Conversation

@Phidias618

Copy link
Copy Markdown

I replaced the previous algorithm that converts integers to ASCII with a much faster one, for example the worst case of this new algorithm is approximately twice as fast as the best case of the previous algorithm.
As an added benefit, the lower the digit count, the faster the algorithm is done.

This algorithm don't require the use of .itoa_fmt_buf, which allows to save some RAM.

I made a few changes to function signatures

  • .utoa_fmt doesn't read __itoa_fmt_len from RAM, it receives it from A instead
  • itoa_fmt follows the __sdcccall(1) calling convention instead of OLDCALL
  • itoa_fmt returns the pointer to the end of the new string instead of returning its length, this allows to get rid of some 16 bit math both in itoa_fmt and in load_text

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