summaryrefslogtreecommitdiff
path: root/bits.h
diff options
context:
space:
mode:
Diffstat (limited to 'bits.h')
-rw-r--r--bits.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/bits.h b/bits.h
index 326329de..f4df6002 100644
--- a/bits.h
+++ b/bits.h
@@ -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])