I've been playing with ARMv8 assembly lately, and printing is much more involved than it seems up front a lot of the time. Does anyone have a good algorithm for printing wider numbers with arbitrary base? How about printing numbers of arbitrary size (beyond the natural machine-width)?
I've been using a character array for my numberline (0123456789abcdef...), get dividend and remainder of number/base and increment a counter, store numbers[remainder] into a 65-byte array at the end of the array - counter, repeat until dividend and remainder are both 0, insert negative symbol if necessary, and print from the counted offset. It works, but I feel like there must be a better way.
I've been using a character array for my numberline (0123456789abcdef...), get dividend and remainder of number/base and increment a counter, store numbers[remainder] into a 65-byte array at the end of the array - counter, repeat until dividend and remainder are both 0, insert negative symbol if necessary, and print from the counted offset. It works, but I feel like there must be a better way.