diff options
Diffstat (limited to 'strings.h')
-rw-r--r-- | strings.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/strings.h b/strings.h new file mode 100644 index 0000000..7721f63 --- /dev/null +++ b/strings.h @@ -0,0 +1,9 @@ +#include <stdint.h> + +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'; + + buf[32] = '\0'; +} |