[Zlib-devel] crc32 big/little endian
Joakim Tjernlund
joakim.tjernlund at transmode.se
Thu Apr 22 03:01:22 EDT 2010
>
> On 4/21/2010 9:32 PM, Mark Adler wrote:
> > On Apr 21, 2010, at 1:11 PM, Joakim Tjernlund wrote:
> >> are you suggesting using u32 is less portable than
> >> using long?
> > ...
> >> I would say that long is less portable.
> >
> > ??
> >
> > How could long be less portable? Every C compiler since the beginning of
> time understands long, even with no header files at all. Obviously I'm
> missing something here.
>
> Of course; you can have a 8 bit cpu with 8 bit int; 16 bit long. It would
> certainly comply with K&R :)
That but more interesting is longs that are 64 bits, these are
contain zero padded u32's and if one changes something in
the crc32 impl. this padding might become non zero and
break crc32 for those systems.
But 64 bits longs could possibly be used to optimize crc32 even
more on such platforms by extending the tables with four more
tables. I don't have a 64 bit platform so am just guessing here.
Jocke
More information about the Zlib-devel
mailing list