summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/coding/gsm0503_coding.h1
-rw-r--r--include/osmocom/core/utils.h2
-rw-r--r--src/coding/gsm0503_coding.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/include/osmocom/coding/gsm0503_coding.h b/include/osmocom/coding/gsm0503_coding.h
index 55375bb9..2f0e6315 100644
--- a/include/osmocom/coding/gsm0503_coding.h
+++ b/include/osmocom/coding/gsm0503_coding.h
@@ -13,7 +13,6 @@
#define GSM0503_GPRS_BURSTS_NBITS (116 * 4)
#define GSM0503_EGPRS_BURSTS_NBITS (348 * 4)
-#define NUM_BYTES(N) ((N + 8 - 1) / 8)
enum gsm0503_egprs_mcs {
EGPRS_MCS0,
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 63a73ab4..1d1ebd8a 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -19,6 +19,8 @@
#define OSMO_STRINGIFY(x) #x
/*! \brief Make a value_string entry from an enum value name */
#define OSMO_VALUE_STRING(x) { x, #x }
+/*! \brief Number of bytes necessary to store given BITS */
+#define OSMO_BYTES_FOR_BITS(BITS) ((BITS + 8 - 1) / 8)
#include <stdint.h>
#include <stdio.h>
diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index 70398632..1e70d2eb 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -901,7 +901,7 @@ static int egprs_decode_data(uint8_t *l2_data, const sbit_t *c,
u, 0, data_len, 1);
/* Return the number of bytes required for the bit message */
- return NUM_BYTES(code->hdr_len + code->data_len);
+ return OSMO_BYTES_FOR_BITS(code->hdr_len + code->data_len);
}
/*! \brief Decode EGPRS UL message