diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-09-12 00:07:23 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-09-12 00:07:23 -0400 |
commit | 3748ed40b6784b1905492e70b33b5d7ce296fa08 (patch) | |
tree | 777882e9495065081a89802ed0e86bd086f0fa21 /bits.h | |
parent | eb9317f72e38d4e7428dcf3f07b820cc64f7d088 (diff) | |
download | gpsd-3748ed40b6784b1905492e70b33b5d7ce296fa08.tar.gz |
More magic-number elimination.
Diffstat (limited to 'bits.h')
-rw-r--r-- | bits.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -15,6 +15,10 @@ #define _GPSD_BITS_H_ #include <stdint.h> +#include <limits.h> + +/* number of bytes requited to contain a bit array of specified length */ +#define BITS_TO_BYTES(bitlen) (((bitlen) + CHAR_BIT - 1) / CHAR_BIT) /* these are independent of byte order */ #define getsb(buf, off) ((int8_t)buf[off]) |