Update spdk crc32.c with ARM CRC32 intrinsics
Implement spdk_crc32_update() with ARM CRC32 intrinsics. Change-Id: I6a64122f5dd3b804408cfae61a205e78fd8c4547 Signed-off-by: Richael Zhuang <richael.zhuang@arm.com> Reviewed-on: https://review.gerrithub.io/c/440828 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
7d1db86f54
commit
a23b8c8c0a
@ -52,6 +52,32 @@ spdk_crc32_table_init(struct spdk_crc32_table *table, uint32_t polynomial_reflec
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SPDK_HAVE_ARM_CRC
|
||||
|
||||
uint32_t
|
||||
spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t len, uint32_t crc)
|
||||
{
|
||||
size_t count;
|
||||
const uint64_t *dword_buf;
|
||||
|
||||
count = len & 7;
|
||||
while (count--) {
|
||||
crc = __crc32b(crc, *(const uint8_t *)buf);
|
||||
buf++;
|
||||
}
|
||||
dword_buf = (const uint64_t *)buf;
|
||||
|
||||
count = len / 8;
|
||||
while (count--) {
|
||||
crc = __crc32d(crc, *dword_buf);
|
||||
dword_buf++;
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t
|
||||
spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t len, uint32_t crc)
|
||||
{
|
||||
@ -64,3 +90,5 @@ spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user