From 4aa78a8bea0d49a5fe6b3759606afd16eaf3de88 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 14 Dec 2015 11:13:30 +0100 Subject: [PATCH] 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 --- src/rlc.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 + #include #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