
6 Apr
2013
6 Apr
'13
9:04 a.m.
Dear Simon Glass,
In message 1365203470-9099-1-git-send-email-sjg@chromium.org you wrote:
When crc32 is handled by the hash library, it requires the data to be in big-endian format, since it reads it byte-wise. Thus at present the 'crc32' command reports incorrect data. For example, previously we might see:
+#ifdef USE_HOSTCC
- crc = htobe32(crc); memcpy(output, &crc, sizeof(crc));
+#else
- put_unaligned_be32(crc, output);
+#endif
Why is this depending on USE_HOSTCC, and not on the endianess?
And why do we need the #ifdef? Can we not always use htobe32() and put_unaligned_be32() ?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"UNIX was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things." - Doug Gwyn