Change in libosmocore[master]: gsm_04_08.h: fix big endian structs

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/.

neels gerrit-no-reply at lists.osmocom.org
Tue May 12 11:51:42 UTC 2020


neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18210 )

Change subject: gsm_04_08.h: fix big endian structs
......................................................................

gsm_04_08.h: fix big endian structs

Affected:
 - struct gsm48_range_1024
 - struct gsm48_range_512
 - struct gsm48_range_256
 - struct gsm48_range_128

In commit [1], the automatic little-to-big-endian compatibility by
struct_endianness.py introduced doubled little/big endian struct listings by
accident, resulting in a wrong big endian structure (due to double reversal in
the original big endian part). Remove the old conditionals around the new
automatic ones to fix the structs for big endian.

[1] Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2

Change-Id: Iaccdd4a204841209f5eb50f336b30962ff00da0b
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 0 insertions(+), 238 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 8370eca..1bca068 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -77,7 +77,6 @@
 void osmo_gsm48_classmark_update(struct osmo_gsm48_classmark *dst, const struct osmo_gsm48_classmark *src);
 int8_t osmo_gsm48_rfpowercap2powerclass(enum gsm_band band, uint8_t rf_power_cap);
 /* Chapter 10.5.2.1b.3 */
-#if OSMO_IS_LITTLE_ENDIAN == 1
 struct gsm48_range_1024 {
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	w1_hi:2,
@@ -131,64 +130,8 @@
 	uint8_t	w15_lo:2, w16:6;
 #endif
 } __attribute__ ((packed));
-#else
-struct gsm48_range_1024 {
-#if OSMO_IS_LITTLE_ENDIAN
-	uint8_t	 form_id:5,
-		f0:1,
-		w1_hi:2;
-	uint8_t	w1_lo;
-	uint8_t	w2_hi;
-	uint8_t	 w2_lo:1,
-		w3_hi:7;
-	uint8_t	 w3_lo:2,
-		w4_hi:6;
-	uint8_t	 w4_lo:2,
-		w5_hi:6;
-	uint8_t	 w5_lo:2,
-		w6_hi:6;
-	uint8_t	 w6_lo:2,
-		w7_hi:6;
-	uint8_t	 w7_lo:2,
-		w8_hi:6;
-	uint8_t	 w8_lo:1,
-		w9:7;
-	uint8_t	 w10:7,
-		w11_hi:1;
-	uint8_t	 w11_lo:6,
-		w12_hi:2;
-	uint8_t	 w12_lo:5,
-		w13_hi:3;
-	uint8_t	 w13_lo:4,
-		w14_hi:4;
-	uint8_t	 w14_lo:3,
-		w15_hi:5;
-	uint8_t	 w15_lo:2,
-		w16:6;
-#elif OSMO_IS_BIG_ENDIAN
-/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
-	uint8_t	 w1_hi:2, f0:1, form_id:5;
-	uint8_t	w1_lo;
-	uint8_t	w2_hi;
-	uint8_t	 w3_hi:7, w2_lo:1;
-	uint8_t	 w4_hi:6, w3_lo:2;
-	uint8_t	 w5_hi:6, w4_lo:2;
-	uint8_t	 w6_hi:6, w5_lo:2;
-	uint8_t	 w7_hi:6, w6_lo:2;
-	uint8_t	 w8_hi:6, w7_lo:2;
-	uint8_t	 w9:7, w8_lo:1;
-	uint8_t	 w11_hi:1, w10:7;
-	uint8_t	 w12_hi:2, w11_lo:6;
-	uint8_t	 w13_hi:3, w12_lo:5;
-	uint8_t	 w14_hi:4, w13_lo:4;
-	uint8_t	 w15_hi:5, w14_lo:3;
-	uint8_t	 w16:6, w15_lo:2;
-#endif
-} __attribute__ ((packed));
-#endif
 
 /* Chapter 10.5.2.1b.4 */
-#if OSMO_IS_LITTLE_ENDIAN == 1
 struct gsm48_range_512 {
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	orig_arfcn_hi:1,
@@ -242,64 +185,8 @@
 	uint8_t	w16_lo:3, w17:5;
 #endif
 } __attribute__ ((packed));
-#else
-struct gsm48_range_512 {
-#if OSMO_IS_LITTLE_ENDIAN
-	uint8_t	 form_id:7,
-		orig_arfcn_hi:1;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 orig_arfcn_lo:1,
-		w1_hi:7;
-	uint8_t	 w1_lo:2,
-		w2_hi:6;
-	uint8_t	 w2_lo:2,
-		w3_hi:6;
-	uint8_t	 w3_lo:2,
-		w4_hi:6;
-	uint8_t	 w4_lo:1,
-		w5:7;
-	uint8_t	 w6:7,
-		w7_hi:1;
-	uint8_t	 w7_lo:6,
-		w8_hi:2;
-	uint8_t	 w8_lo:4,
-		w9_hi:4;
-	uint8_t	 w9_lo:2,
-		w10:6;
-	uint8_t	 w11:6,
-		w12_hi:2;
-	uint8_t	 w12_lo:4,
-		w13_hi:4;
-	uint8_t	 w13_lo:2,
-		w14:6;
-	uint8_t	 w15:6,
-		w16_hi:2;
-	uint8_t	 w16_lo:3,
-		w17:5;
-#elif OSMO_IS_BIG_ENDIAN
-/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
-	uint8_t	 orig_arfcn_hi:1, form_id:7;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 w1_hi:7, orig_arfcn_lo:1;
-	uint8_t	 w2_hi:6, w1_lo:2;
-	uint8_t	 w3_hi:6, w2_lo:2;
-	uint8_t	 w4_hi:6, w3_lo:2;
-	uint8_t	 w5:7, w4_lo:1;
-	uint8_t	 w7_hi:1, w6:7;
-	uint8_t	 w8_hi:2, w7_lo:6;
-	uint8_t	 w9_hi:4, w8_lo:4;
-	uint8_t	 w10:6, w9_lo:2;
-	uint8_t	 w12_hi:2, w11:6;
-	uint8_t	 w13_hi:4, w12_lo:4;
-	uint8_t	 w14:6, w13_lo:2;
-	uint8_t	 w16_hi:2, w15:6;
-	uint8_t	 w17:5, w16_lo:3;
-#endif
-} __attribute__ ((packed));
-#endif
 
 /* Chapter 10.5.2.1b.5 */
-#if OSMO_IS_LITTLE_ENDIAN == 1
 struct gsm48_range_256 {
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	orig_arfcn_hi:1,
@@ -359,70 +246,8 @@
 	uint8_t	w20_lo:3, w21:4, spare:1;
 #endif
 } __attribute__ ((packed));
-#else
-struct gsm48_range_256 {
-#if OSMO_IS_LITTLE_ENDIAN
-	uint8_t	 form_id:7,
-		orig_arfcn_hi:1;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 orig_arfcn_lo:1,
-		w1_hi:7;
-	uint8_t	 w1_lo:1,
-		w2:7;
-	uint8_t	 w3:7,
-		w4_hi:1;
-	uint8_t	 w4_lo:5,
-		w5_hi:3;
-	uint8_t	 w5_lo:3,
-		w6_hi:5;
-	uint8_t	 w6_lo:1,
-		 w7:6,
-		w8_hi:1;
-	uint8_t	 w8_lo:4,
-		w9_hi:4;
-	uint8_t	 w9_lo:1,
-		 w10:5,
-		w11_hi:2;
-	uint8_t	 w11_lo:3,
-		w12:5;
-	uint8_t	 w13:5,
-		w14_hi:3;
-	uint8_t	 w14_lo:2,
-		 w15:5,
-		w16_hi:1;
-	uint8_t	 w16_lo:3,
-		 w17:4,
-		w18_hi:1;
-	uint8_t	 w18_lo:3,
-		 w19:4,
-		w20_hi:1;
-	uint8_t	 w20_lo:3,
-		 w21:4,
-		spare:1;
-#elif OSMO_IS_BIG_ENDIAN
-/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
-	uint8_t	 orig_arfcn_hi:1, form_id:7;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 w1_hi:7, orig_arfcn_lo:1;
-	uint8_t	 w2:7, w1_lo:1;
-	uint8_t	 w4_hi:1, w3:7;
-	uint8_t	 w5_hi:3, w4_lo:5;
-	uint8_t	 w6_hi:5, w5_lo:3;
-	uint8_t	 w8_hi:1, w7:6, w6_lo:1;
-	uint8_t	 w9_hi:4, w8_lo:4;
-	uint8_t	 w11_hi:2, w10:5, w9_lo:1;
-	uint8_t	 w12:5, w11_lo:3;
-	uint8_t	 w14_hi:3, w13:5;
-	uint8_t	 w16_hi:1, w15:5, w14_lo:2;
-	uint8_t	 w18_hi:1, w17:4, w16_lo:3;
-	uint8_t	 w20_hi:1, w19:4, w18_lo:3;
-	uint8_t	 spare:1, w21:4, w20_lo:3;
-#endif
-} __attribute__ ((packed));
-#endif
 
 /* Chapter 10.5.2.1b.6 */
-#if OSMO_IS_LITTLE_ENDIAN == 1
 struct gsm48_range_128 {
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t	orig_arfcn_hi:1,
@@ -484,69 +309,6 @@
 	uint8_t	w26_lo:1, w27:3, w28:3, spare:1;
 #endif
 } __attribute__ ((packed));
-#else
-struct gsm48_range_128 {
-#if OSMO_IS_LITTLE_ENDIAN
-	uint8_t	 form_id:7,
-		orig_arfcn_hi:1;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 orig_arfcn_lo:1,
-		w1:7;
-	uint8_t	 w2:6,
-		w3_hi:2;
-	uint8_t	 w3_lo:4,
-		w4_hi:4;
-	uint8_t	 w4_lo:1,
-		 w5:5,
-		w6_hi:2;
-	uint8_t	 w6_lo:3,
-		w7:5;
-	uint8_t	 w8:4,
-		w9:4;
-	uint8_t	 w10:4,
-		w11:4;
-	uint8_t	 w12:4,
-		w13:4;
-	uint8_t	 w14:4,
-		w15:4;
-	uint8_t	 w16:3,
-		 w17:3,
-		w18_hi:2;
-	uint8_t	 w18_lo:1,
-		 w19:3,
-		 w20:3,
-		w21_hi:1;
-	uint8_t	 w21_lo:2,
-		 w22:3,
-		w23:3;
-	uint8_t	 w24:3,
-		 w25:3,
-		w26_hi:2;
-	uint8_t	 w26_lo:1,
-		 w27:3,
-		 w28:3,
-		spare:1;
-#elif OSMO_IS_BIG_ENDIAN
-/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
-	uint8_t	 orig_arfcn_hi:1, form_id:7;
-	uint8_t	orig_arfcn_mid;
-	uint8_t	 w1:7, orig_arfcn_lo:1;
-	uint8_t	 w3_hi:2, w2:6;
-	uint8_t	 w4_hi:4, w3_lo:4;
-	uint8_t	 w6_hi:2, w5:5, w4_lo:1;
-	uint8_t	 w7:5, w6_lo:3;
-	uint8_t	 w9:4, w8:4;
-	uint8_t	 w11:4, w10:4;
-	uint8_t	 w13:4, w12:4;
-	uint8_t	 w15:4, w14:4;
-	uint8_t	 w18_hi:2, w17:3, w16:3;
-	uint8_t	 w21_hi:1, w20:3, w19:3, w18_lo:1;
-	uint8_t	 w23:3, w22:3, w21_lo:2;
-	uint8_t	 w26_hi:2, w25:3, w24:3;
-	uint8_t	 spare:1, w28:3, w27:3, w26_lo:1;
-#endif
-} __attribute__ ((packed));
-#endif
 
 /* Chapter 10.5.2.1b.7 */
 struct gsm48_var_bit {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iaccdd4a204841209f5eb50f336b30962ff00da0b
Gerrit-Change-Number: 18210
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200512/d85a0361/attachment.htm>


More information about the gerrit-log mailing list