cochran_emc.h: packed structs
Lubomir I. Ivanov
neolit123 at gmail.com
Tue Oct 28 12:11:42 PDT 2014
On 28 October 2014 20:43, Thiago Macieira <thiago at macieira.org> wrote:
> 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.
>
Dirk,
just use this previous patch - keeps everything packed as the author
indented, but simply adds the extra 'gcc_struct' attribute and fixes
the MINGW scenario where 'packed'-only doesn't work the same way as
GCC with 'packed' only.
lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Use-gcc_struct-with-the-packed-attribute.patch
Type: application/octet-stream
Size: 2170 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141028/aea27a0f/attachment.obj>
More information about the subsurface
mailing list