If I know I am on a little-endian machine, how can I convert the endiannes of a 14-bit bitfield?
struct {
unsigned foo : 14, bar 2;
} baz;
I have a hunch that baz.foo = htons(baz.foo)
will not work properly.
If I know I am on a little-endian machine, how can I convert the endiannes of a 14-bit bitfield?
struct {
unsigned foo : 14, bar 2;
} baz;
I have a hunch that baz.foo = htons(baz.foo)
will not work properly.