add/clean big-endian packed structs (struct_endianess.py)
This is 1:1 the result of doing
cd libosmocore
./contrib/struct_endianess.py
git commit -a
Running struct_endianess.py again should result in no changes.
That means we could include such a check in the gerrit verification job now.
Change-Id: Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2
diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h
index 2e0ad69..1b399ae 100644
--- a/include/osmocom/gsm/protocol/gsm_03_41.h
+++ b/include/osmocom/gsm/protocol/gsm_03_41.h
@@ -19,35 +19,34 @@
/* Chapter 9.3.2 */
struct gsm341_ms_message {
struct {
-#if OSMO_IS_LITTLE_ENDIAN == 1
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t code_hi:6;
uint8_t gs:2;
uint8_t update:4;
uint8_t code_lo:4;
-#else
- uint8_t gs:2;
- uint8_t code_hi:6;
- uint8_t code_lo:4;
- uint8_t update:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t gs:2, code_hi:6;
+ uint8_t code_lo:4, update:4;
#endif
} serial;
uint16_t msg_id;
struct {
-#if OSMO_IS_LITTLE_ENDIAN == 1
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t language:4;
uint8_t group:4;
-#else
- uint8_t group:4;
- uint8_t language:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t group:4, language:4;
#endif
} dcs;
struct {
-#if OSMO_IS_LITTLE_ENDIAN == 1
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t total:4;
uint8_t current:4;
-#else
- uint8_t current:4;
- uint8_t total:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t current:4, total:4;
#endif
} page;
uint8_t data[0];
@@ -56,20 +55,17 @@
/* Chapter 9.4.1.3 */
struct gsm341_etws_message {
struct {
-#if OSMO_IS_LITTLE_ENDIAN == 1
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t code_hi:4;
uint8_t popup:1;
uint8_t alert:1;
uint8_t gs:2;
uint8_t update:4;
uint8_t code_lo:4;
-#else
- uint8_t gs:2;
- uint8_t alert:1;
- uint8_t popup:1;
- uint8_t code_hi:4;
- uint8_t code_lo:4;
- uint8_t update:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t gs:2, alert:1, popup:1, code_hi:4;
+ uint8_t code_lo:4, update:4;
#endif
} serial;
uint16_t msg_id;