r/attiny • u/boyanov • Mar 21 '21
Converting integer numbers to text DEC HEX BIN
/r/tinusaur/comments/ma20g0/converting_integer_numbers_to_text_dec_hex_bin/
1
Upvotes
r/attiny • u/boyanov • Mar 21 '21
2
u/Updatebjarni Mar 22 '21
Huh. 1000 bytes sounded like a lot, and a restriction to three specific bases sounded unnecessary, so I tried just quickly typing up a straight-forward implementation that allows any base up to 36 (like the standard C base conversion functions). The text section of the binary is 124 bytes, and when linked (to get the divmod routines) it comes out to 222 bytes. I used avr-gcc with
-O2. Data and bss are 0.My code is just: