-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for ARM requires non-accelerated CRC. (#264)
- Loading branch information
Showing
14 changed files
with
91 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,4 @@ cmake-*/** | |
# Visual Studio | ||
CMakeSettings.json | ||
.vs/** | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
// Only x86 and x86_64 supported by Intel Storage Acceleration library | ||
#ifndef NO_ISAL | ||
#include <isa-l/crc.h> | ||
|
||
#else | ||
|
||
extern "C" { | ||
// crc16_t10dif reference function, slow crc16 from the definition. | ||
uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len); | ||
|
||
// crc32_ieee reference function, slow crc32 from the definition. | ||
uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Only x86 and x86_64 supported by Intel Storage Acceleration library | ||
#ifdef NO_ISAL | ||
|
||
#include <cstdint> | ||
#include <cstddef> | ||
extern "C" { | ||
#define MAX_ITER 8 | ||
|
||
// crc16_t10dif reference function, slow crc16 from the definition. | ||
uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len) { | ||
size_t rem = seed; | ||
unsigned int i, j; | ||
|
||
uint16_t poly = 0x8bb7; // t10dif standard | ||
|
||
for (i = 0; i < len; i++) { | ||
rem = rem ^ (buf[i] << 8); | ||
for (j = 0; j < MAX_ITER; j++) { | ||
rem = rem << 1; | ||
rem = (rem & 0x10000) ? rem ^ poly : rem; | ||
} | ||
} | ||
return rem; | ||
} | ||
|
||
// crc32_ieee reference function, slow crc32 from the definition. | ||
uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len) { | ||
uint64_t rem = ~seed; | ||
unsigned int i, j; | ||
|
||
uint32_t poly = 0x04C11DB7; // IEEE standard | ||
|
||
for (i = 0; i < len; i++) { | ||
rem = rem ^ ((uint64_t)buf[i] << 24); | ||
for (j = 0; j < MAX_ITER; j++) { | ||
rem = rem << 1; | ||
rem = (rem & 0x100000000ULL) ? rem ^ poly : rem; | ||
} | ||
} | ||
return ~rem; | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters