cochran_emc.h: packed structs
Thiago Macieira
thiago at macieira.org
Tue Oct 28 11:43:19 PDT 2014
On Tuesday 28 October 2014 09:32:17 Dirk Hohndel wrote:
> A typical 8 byte sample might look like this:
>
> struct sample {
> unsigned char temp; // in F
> unsigned int16_t depth; // in 1/16 ft
> unsigned int16_t deco : 1;
> unsigned int16_t tank_idx : 2;
> unsigned int16_t marker : 1;
> unsigned int16_t ascend_warn : 1;
> unsigned int16_t compass : 9;
> unsigned int16_t pressure; // in psi
> unsigned char flags;
> }
>
> I made this up - it's much simpler than some real structures actually are.
Yep, I get it. But without the packing, there's a 1-byte hole between temp and
the depth, then one byte tail-padding at the end of the structure.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
More information about the subsurface
mailing list