@@ -77,36 +77,29 @@ static u32 crc32_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
{
u32 crc = crc_;
-#ifdef CONFIG_64BIT
- while (len >= sizeof(u64)) {
+#if IS_ENABLED(CONFIG_64BIT)
+ for (; len >= sizeof(u64); p += sizeof(u64), len -= sizeof(u64)) {
u64 value = get_unaligned_le64(p);
-
CRC32(crc, value, d);
- p += sizeof(u64);
- len -= sizeof(u64);
}
if (len & sizeof(u32)) {
#else /* !CONFIG_64BIT */
- while (len >= sizeof(u32)) {
+ for (; len >= sizeof(u32); len -= sizeof(u32)) {
#endif
u32 value = get_unaligned_le32(p);
-
CRC32(crc, value, w);
p += sizeof(u32);
- len -= sizeof(u32);
}
if (len & sizeof(u16)) {
u16 value = get_unaligned_le16(p);
-
CRC32(crc, value, h);
p += sizeof(u16);
}
if (len & sizeof(u8)) {
u8 value = *p++;
-
CRC32(crc, value, b);
}
@@ -117,38 +110,32 @@ static u32 crc32c_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
{
u32 crc = crc_;
-#ifdef CONFIG_64BIT
- while (len >= sizeof(u64)) {
+#if IS_ENABLED(CONFIG_64BIT)
+ for (; len >= sizeof(u64); p += sizeof(u64), len -= sizeof(u64)) {
u64 value = get_unaligned_le64(p);
-
CRC32C(crc, value, d);
- p += sizeof(u64);
- len -= sizeof(u64);
}
if (len & sizeof(u32)) {
#else /* !CONFIG_64BIT */
- while (len >= sizeof(u32)) {
+ for (; len >= sizeof(u32); len -= sizeof(u32)) {
#endif
u32 value = get_unaligned_le32(p);
-
CRC32C(crc, value, w);
p += sizeof(u32);
- len -= sizeof(u32);
}
if (len & sizeof(u16)) {
u16 value = get_unaligned_le16(p);
-
CRC32C(crc, value, h);
p += sizeof(u16);
}
if (len & sizeof(u8)) {
u8 value = *p++;
-
CRC32C(crc, value, b);
}
+
return crc;
}