On Sat, Aug 10, 2013 at 5:09 AM, Ben Pfaff <b...@nicira.com> wrote: > On Wed, Jul 31, 2013 at 09:31:55AM +0900, Joe Stringer wrote: > > +ovs_be32 > > +crc32c(const uint8_t *data, size_t size) > > +{ > > + uint32_t crc = 0xffffffffL; > > + > > + while (size--) { > > + crc = crc32Table[(crc ^ *data++) & 0xff] ^ (crc >> 8); > > + } > > + > > + /* The result of this CRC calculation provides us a value in the > reverse > > + * byte-order as compared with our architecture. On big-endian > systems, > > + * this is opposite to our return type. So, to return a big-endian > > + * value, we must swap the byte-order. */ > > +#if defined(WORDS_BIGENDIAN) > > + crc = get_unaligned_u32(&crc); > > +#endif > > I don't see how this does any kind of byteswapping (as the comment > claims). Just treating 'crc' as unaligned (&crc should in fact be > properly aligned) has no effect. As far as I can tell it is > equivalent to "crc = crc;"
Ah, right you are. I think I got a bit lost on my way to a byteswapping function. I'll fix this up. Unfortunately I don't have a system to test this on.
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev