aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-14 11:13:30 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-15 15:19:43 +0100
commit4aa78a8bea0d49a5fe6b3759606afd16eaf3de88 (patch)
treec51667a6a19ef90f5f8aaa446de9eb2094881bd4
parent6c3dc61db58bf469c504ffbfcbe061de2f18ceac (diff)
rlc: Check endianness for bit field declarations
Currently the declarations of rlc_ul_header, rlc_dl_header, and rlc_li_field silently assume that a gcc for a little endian platform is being used. This commit adds '#if OSMO_IS_LITTLE_ENDIAN' the ensure the correct byte ordering. Sponsored-by: On-Waves ehf
-rw-r--r--src/rlc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rlc.h b/src/rlc.h
index 313f3c72..89af2197 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -19,6 +19,8 @@
*/
#pragma once
+#include <osmocom/core/endian.h>
+
#include <stdint.h>
#define RLC_MAX_SNS 128 /* GPRS, must be power of 2 */
@@ -186,6 +188,7 @@ struct gprs_rlc_ul_window {
extern "C" {
/* TS 04.60 10.2.2 */
+#if OSMO_IS_LITTLE_ENDIAN
struct rlc_ul_header {
uint8_t r:1,
si:1,
@@ -216,6 +219,9 @@ struct rlc_li_field {
m:1,
li:6;
} __attribute__ ((packed));
+#else
+# error "Only little endian headers are supported yet. TODO: add missing structs"
+#endif
}
inline bool gprs_rlc_v_b::is_state(int bsn, const gprs_rlc_dl_bsn_state type) const