aboutsummaryrefslogtreecommitdiff
path: root/strings.h
blob: 8d4b5119914846405cdb0934c03b8f13d8848511 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef STRINGS_H
#define STRINGS_H

#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';

  buf[32] = '\0';
}

#endif // STRINGS_H