Change in osmo-pcu[master]: rlc.h: Fix struct bit fields on big endian systems

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Feb 4 14:05:44 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22688 )

Change subject: rlc.h: Fix struct bit fields on big endian systems
......................................................................

rlc.h: Fix struct bit fields on big endian systems

Related: OS#5003
Change-Id: I534539cdf197ce5c038752a177aff7efeefc9883
---
M src/rlc.h
1 file changed, 24 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/rlc.h b/src/rlc.h
index bcc738c..45cbb95 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -377,8 +377,8 @@
 
 extern "C" {
 /* TS 44.060  10.2.2 */
-#if OSMO_IS_LITTLE_ENDIAN
 struct rlc_ul_header {
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	r:1,
 		 si:1,
 		 cv:4,
@@ -389,9 +389,16 @@
 		 spare:1;
 	uint8_t	e:1,
 		 bsn:7;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t	pt:2, cv:4, si:1, r:1;
+	uint8_t	spare:1, pi:1, tfi:5, ti:1;
+	uint8_t	bsn:7, e:1;
+#endif
 } __attribute__ ((packed));
 
 struct rlc_dl_header {
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	usf:3,
 		 s_p:1,
 		 rrbp:2,
@@ -401,21 +408,34 @@
 		 pr:2;
 	uint8_t	e:1,
 		 bsn:7;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t	pt:2, rrbp:2, s_p:1, usf:3;
+	uint8_t	pr:2, tfi:5, fbi:1;
+	uint8_t	bsn:7, e:1;
+#endif
 } __attribute__ ((packed));
 
 struct rlc_li_field {
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	e:1,
 		 m:1,
 		 li:6;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t	li:6, m:1, e:1;
+#endif
 } __attribute__ ((packed));
 
 struct rlc_li_field_egprs {
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	e:1,
 		 li:7;
-} __attribute__ ((packed));
-#else
-#  error "Only little endian headers are supported yet. TODO: add missing structs"
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t	li:7, e:1;
 #endif
+} __attribute__ ((packed));
 }
 
 inline bool gprs_rlc_v_b::is_state(int bsn, const gprs_rlc_dl_bsn_state type) const

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22688
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I534539cdf197ce5c038752a177aff7efeefc9883
Gerrit-Change-Number: 22688
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210204/5ac2e8d8/attachment.htm>


More information about the gerrit-log mailing list