(In reply to Lubos Lunak from comment #38)
> > imho to use #if defined(VG_BIGENDIAN) instead of doing a runtime trick.
>
> Updated.
Thanks, looks good.
> > Is the big endian variant correct?
>
> I don't have actual big endian HW, but I think it is. The input is 3-byte
> bigendian that needs byte-by-byte handling, not the output.
It is a little tricky to know how to interpret endianness for these "3-byte" values.
But what I mean is that I believe others interpret this as a 4-byte value where the 4th byte is zero.
Which doesn't matter for little endian, but does for big endian.
With the assumption of the 4th byte is zero the code would look like:
(In reply to Lubos Lunak from comment #38) VG_BIGENDIAN) instead of doing a runtime trick.
> > imho to use #if defined(
>
> Updated.
Thanks, looks good.
> > Is the big endian variant correct?
>
> I don't have actual big endian HW, but I think it is. The input is 3-byte
> bigendian that needs byte-by-byte handling, not the output.
It is a little tricky to know how to interpret endianness for these "3-byte" values.
But what I mean is that I believe others interpret this as a 4-byte value where the 4th byte is zero.
Which doesn't matter for little endian, but does for big endian.
With the assumption of the 4th byte is zero the code would look like:
c1 = ML_(img_ get_UChar) (c->sli. img, c->sli_next); get_UChar) (c->sli. img, c->sli_next+1); get_UChar) (c->sli. img, c->sli_next+2); VG_BIGENDIAN)
c2 = ML_(img_
c3 = ML_(img_
c4 = 0;
c->sli_next += 3;
#if defined(
return c1 << 24 | c2 << 16 | c3 << 8 | c4;
#else
return c1 | c2 << 8 | c3 << 16 | c4 << 24;
#endif