On Wed, Dec 09, 2015 at 12:41:33PM -0500, Jaroslav Skarvada wrote:
this works for me, but I still don't understand why, the ordering of bitfields looks quite strange to me :)
The reversal needs to be done byte-wise. So in this example:
+#if OSMO_IS_LITTLE_ENDIAN == 1 uint8_t code_hi:6; uint8_t gs:2; uint8_t update:4; uint8_t code_lo:4;
The first byte is code_hi and gs, reverse those:
+#else + uint8_t gs:2; + uint8_t code_hi:6;
Next byte is update and code_lo, reversed:
+ uint8_t code_lo:4; + uint8_t update:4; +#endif
I hope that helps :) ~Neels
+#if OSMO_IS_LITTLE_ENDIAN == 1 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; +#endif
-- - Neels Hofmeyr <nhofmeyr@sysmocom.de> http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschäftsführer / Managing Directors: Holger Freyther, Harald Welte