The test suite for libosmocore fails on big-endian architectures

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/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Dec 9 22:13:30 UTC 2015


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20151209/94e0413b/attachment.bin>


More information about the OpenBSC mailing list