cochran_emc.h: packed structs
Dirk Hohndel
dirk at hohndel.org
Tue Oct 28 11:41:29 PDT 2014
On Tue, Oct 28, 2014 at 11:29:48AM -0700, Thiago Macieira wrote:
> 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.
I meant it when I said "any random number". Yes, we USUALLY see multiples
of 4, but there are others. Like 37 (0x25).
> 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.
It certainly is. If there is anything insane, broken or stupid that could
be done in a data protocol, chances are good that it has been done in the
Uemis protocol. Including an offset of 0x123 for the divelog data. Of
course, 3 x 97. And then 37 byte samples on top of that. What could
possibly go wrong?
/D
More information about the subsurface
mailing list