Re: Nybblepair



Bruno van Dooren schrieb:

this will make your bitfield 1 byte in size.
struct Nybblepair
{
unsigned char nybble2 : 4;
unsigned char nybble1 : 4;
};


Please note that even if this code works on your target, it is not portable code. The order and alignment in which a compiler assigns bits in a bit field is not specified (at least not in ANSI-C). I've seen at least three different implementations of this with several different compilers.

Norbert

.