cochran_emc.h: packed structs

Thiago Macieira thiago at macieira.org
Tue Oct 28 11:29:48 PDT 2014


On Tuesday 28 October 2014 09:34:33 Dirk Hohndel wrote:
> On Tue, Oct 28, 2014 at 09:28:31AM -0700, Thiago Macieira wrote:
> > Are we sure of the sample size? It's an odd number of bytes...
> 
> We have dive computers with non-constant sample sizes. And pretty much any
> random number you can think of. Yes, 8 is common, as are 12 or 16.

8, 12, 16, 24, 32, 64 are fine.

uemis_sample_t is 37 (0x25) bytes in size with the packing and is used like 
this:

        /* first byte of divelog data is at offset 0x123 */
        i = 0x123;
        u_sample = (uemis_sample_t *)(data + i);
        while ((i < datalen) && (u_sample->dive_time)) {
[...]
                i += 0x25;
                u_sample++;
        }

Given the i += 0x25, it seems that the size is as intended.

-- 
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