diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-30 17:34:23 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-30 17:34:23 +0100 |
commit | c9e045dc2170a99c9f32386e3e53aee9e01a8e7c (patch) | |
tree | faa57aef89cd1a03efc665c1e5809cf4f0304269 /strings.h | |
parent | eae54c24e2e2b89f399bc2d3be195468c2e462a5 (diff) | |
download | rpi-MMU-example-c9e045dc2170a99c9f32386e3e53aee9e01a8e7c.tar.gz rpi-MMU-example-c9e045dc2170a99c9f32386e3e53aee9e01a8e7c.zip |
io api rework
Diffstat (limited to 'strings.h')
-rw-r--r-- | strings.h | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -3,12 +3,22 @@ #include <stdint.h> -static inline void uint32_to_bits(uint32_t number, char *buf) -{ - for (int i = 0; i < 32; i++) - buf[i] = ((number >> (32 - i - 1)) & 1) ? '1' : '0'; +void uint32_to_dec(uint32_t number, char buf[10]); - buf[32] = '\0'; -} +void uint32_to_hex(uint32_t number, char buf[8]); + +void uint32_to_bin(uint32_t number, char buf[32]); + +void uint32_to_decstring(uint32_t number, char buf[11]); + +void uint32_to_hexstring(uint32_t number, char buf[9]); + +void uint32_to_binstring(uint32_t number, char buf[33]); + +void trim_0s(char string[]); + +void uint32_to_decstringt(uint32_t number, char buf[11]); + +void uint32_to_hexstringt(uint32_t number, char buf[9]); #endif // STRINGS_H |