Fast integer-to-string conversion (ARM32)

A forum for ARM assembly programmers (32 & 64 bit)
Post Reply
rhyde
Site Admin
Posts: 51
Joined: Sun Dec 04, 2022 5:36 pm

Fast integer-to-string conversion (ARM32)

Post by rhyde »

Attached are a couple of u32ToBuf/u32ToStr functions that convert a 32-bit unsigned value in R1 to a string of digits (stored at the location pointed at by R0).

One variant uses a "Radix-100" algorithm to process two output digits simultaneously. It includes a 200-byte lookup table to process pairs of characters for values in the range 0..99. The second version has a 40,000-byte lookup table and emits four characters simultaneously (0..9999). If you can live with the giant table, it's about 40% faster than the 2-character version.
Attachments
Listing9-5.zip
2-character version
(16.71 KiB) Downloaded 164 times
Listing9-5a.zip
4-character version
(56.52 KiB) Downloaded 177 times
Post Reply