[U-Boot] [PATCH v3] crc32: Impl. linux optimized crc32()
Thiago A. Corrêa
thiago.correa at gmail.com
Thu Nov 19 19:22:43 CET 2009
Hi,
2009/11/19 Joakim Tjernlund <joakim.tjernlund at transmode.se>:
>
> The whole point of the tole define is to make the table more
> readable. Try and replace tole in the table and then
> look at it.
>
Ah, ok. Then I think this one at make_crc_table should use the
__cpu_to_le32() as tole only porpuse is a more readable table, then
you could lose the first tole define as __cpu_to_le32 and keep only
the one defined as __constant_cpu_to_le32. Also, I don't know how you
are not getting a warning from the preprocessor about the redefined
tole macro:
+#define tole(x) __cpu_to_le32(x)
local void make_crc_table()
{
uint32_t c;
@@ -70,7 +73,7 @@ local void make_crc_table()
c = (uLong)n;
for (k = 0; k < 8; k++)
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[n] = c;
+ crc_table[n] = tole(c);
}
crc_table_empty = 0;
}
@@ -78,59 +81,73 @@ local void make_crc_table()
/* ========================================================================
* Table of CRC-32's of all single-byte values (made by make_crc_table)
*/
+#define tole(x) __constant_cpu_to_le32(x)
+
I'm not looking at the whole file but since you introduced in this
diff a +#define tole, and there is no +#undef tole, you should be
getting warnings. Except for possibly the warning, my suggestion was
very cosmetic. On the other hand, I didn't notice the redefinition,
that usually causes a lot of maintenance trouble latter on.
Kind Regards,
Thiago A. Correa
More information about the U-Boot
mailing list