Fix header guards.

This commit is contained in:
2021-10-13 03:30:02 +01:00
parent 134709f90f
commit ca65d12c7e
8 changed files with 40 additions and 10 deletions

View File

@@ -16,8 +16,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE__ARM_VMULL_H_ #ifndef AARU_CHECKSUMS_NATIVE_ARM_VMULL_H
#define AARU_CHECKSUMS_NATIVE__ARM_VMULL_H_ #define AARU_CHECKSUMS_NATIVE_ARM_VMULL_H
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) #if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
@@ -29,4 +29,4 @@ TARGET_WITH_SIMD uint64x2_t mm_slli_si128(uint64x2_t a, int imm);
#endif #endif
#endif // AARU_CHECKSUMS_NATIVE__ARM_VMULL_H_ #endif // AARU_CHECKSUMS_NATIVE_ARM_VMULL_H

View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_CRC16_H
#define AARU_CHECKSUMS_NATIVE_CRC16_H
typedef struct typedef struct
{ {
uint16_t crc; uint16_t crc;
@@ -178,4 +181,6 @@ const uint16_t crc16_table[8][256] = {
AARU_EXPORT crc16_ctx* AARU_CALL crc16_init(); AARU_EXPORT crc16_ctx* AARU_CALL crc16_init();
AARU_EXPORT int AARU_CALL crc16_update(crc16_ctx* ctx, const uint8_t* data, uint32_t len); AARU_EXPORT int AARU_CALL crc16_update(crc16_ctx* ctx, const uint8_t* data, uint32_t len);
AARU_EXPORT int AARU_CALL crc16_final(crc16_ctx* ctx, uint16_t* crc); AARU_EXPORT int AARU_CALL crc16_final(crc16_ctx* ctx, uint16_t* crc);
AARU_EXPORT void AARU_CALL crc16_free(crc16_ctx* ctx); AARU_EXPORT void AARU_CALL crc16_free(crc16_ctx* ctx);
#endif // AARU_CHECKSUMS_NATIVE_CRC16_H

View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_CRC16_CCITT_H
#define AARU_CHECKSUMS_NATIVE_CRC16_CCITT_H
typedef struct typedef struct
{ {
uint16_t crc; uint16_t crc;
@@ -177,4 +180,6 @@ const uint16_t crc16_ccitt_table[8][256] = {
AARU_EXPORT crc16_ccitt_ctx* AARU_CALL crc16_ccitt_init(); AARU_EXPORT crc16_ccitt_ctx* AARU_CALL crc16_ccitt_init();
AARU_EXPORT int AARU_CALL crc16_ccitt_update(crc16_ccitt_ctx* ctx, const uint8_t* data, uint32_t len); AARU_EXPORT int AARU_CALL crc16_ccitt_update(crc16_ccitt_ctx* ctx, const uint8_t* data, uint32_t len);
AARU_EXPORT int AARU_CALL crc16_ccitt_final(crc16_ccitt_ctx* ctx, uint16_t* crc); AARU_EXPORT int AARU_CALL crc16_ccitt_final(crc16_ccitt_ctx* ctx, uint16_t* crc);
AARU_EXPORT void AARU_CALL crc16_ccitt_free(crc16_ccitt_ctx* ctx); AARU_EXPORT void AARU_CALL crc16_ccitt_free(crc16_ccitt_ctx* ctx);
#endif // AARU_CHECKSUMS_NATIVE_CRC16_H

View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_CRC32_H
#define AARU_CHECKSUMS_NATIVE_CRC32_H
typedef struct typedef struct
{ {
uint32_t crc; uint32_t crc;
@@ -277,4 +280,6 @@ AARU_EXPORT TARGET_ARMV8_WITH_CRC uint32_t AARU_CALL armv8_crc32_little(uint32_t
uint32_t len); uint32_t len);
#endif #endif
AARU_EXPORT TARGET_WITH_SIMD uint32_t AARU_CALL crc32_vmull(uint32_t previous_crc, const uint8_t* data, long len); AARU_EXPORT TARGET_WITH_SIMD uint32_t AARU_CALL crc32_vmull(uint32_t previous_crc, const uint8_t* data, long len);
#endif #endif
#endif // AARU_CHECKSUMS_NATIVE_CRC32_H

View File

@@ -16,8 +16,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE__CRC32_SIMD_H_ #ifndef AARU_CHECKSUMS_NATIVE_CRC32_SIMD_H
#define AARU_CHECKSUMS_NATIVE__CRC32_SIMD_H_ #define AARU_CHECKSUMS_NATIVE_CRC32_SIMD_H
static const unsigned ALIGNED_(32) pshufb_shf_table[60] = { static const unsigned ALIGNED_(32) pshufb_shf_table[60] = {
0x84838281, 0x88878685, 0x8c8b8a89, 0x008f8e8d, /* shl 15 (16 - 1)/shr1 */ 0x84838281, 0x88878685, 0x8c8b8a89, 0x008f8e8d, /* shl 15 (16 - 1)/shr1 */
@@ -63,4 +63,4 @@ static const unsigned ALIGNED_(16) crc_mask2[4] = {0x00000000, 0xFFFFFFFF, 0xFFF
(op); \ (op); \
} }
#endif // AARU_CHECKSUMS_NATIVE__CRC32_SIMD_H_ #endif // AARU_CHECKSUMS_NATIVE_CRC32_SIMD_H

View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_CRC64_H
#define AARU_CHECKSUMS_NATIVE_CRC64_H
typedef struct typedef struct
{ {
uint64_t crc; uint64_t crc;
@@ -247,4 +250,6 @@ AARU_EXPORT CLMUL uint64_t AARU_CALL crc64_clmul(uint64_t crc, const uint8_t* da
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) #if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL crc64_vmull(uint64_t previous_crc, const uint8_t* data, long len); AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL crc64_vmull(uint64_t previous_crc, const uint8_t* data, long len);
#endif #endif
#endif // AARU_CHECKSUMS_NATIVE_CRC64_H

5
simd.h
View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_SIMD_H
#define AARU_CHECKSUMS_NATIVE_SIMD_H
#ifdef _MSC_VER #ifdef _MSC_VER
#define ALIGNED_(n) __declspec(align(n)) #define ALIGNED_(n) __declspec(align(n))
#else #else
@@ -116,3 +119,5 @@ AARU_EXPORT int have_arm_crypto(void);
#endif // _MSC_VER #endif // _MSC_VER
#endif // __aarch64__ || _M_ARM64 || __arm__ || _M_ARM #endif // __aarch64__ || _M_ARM64 || __arm__ || _M_ARM
#endif // AARU_CHECKSUMS_NATIVE_CRC32_SIMD_H

View File

@@ -16,6 +16,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef AARU_CHECKSUMS_NATIVE_SPAMSUM_H
#define AARU_CHECKSUMS_NATIVE_SPAMSUM_H
#define SPAMSUM_LENGTH 64 #define SPAMSUM_LENGTH 64
#define NUM_BLOCKHASHES 31 #define NUM_BLOCKHASHES 31
#define ROLLING_WINDOW 7 #define ROLLING_WINDOW 7
@@ -60,3 +63,5 @@ AARU_LOCAL void fuzzy_engine_step(spamsum_ctx* ctx, uint8_t c);
AARU_LOCAL void roll_hash(spamsum_ctx* ctx, uint8_t c); AARU_LOCAL void roll_hash(spamsum_ctx* ctx, uint8_t c);
AARU_LOCAL void fuzzy_try_reduce_blockhash(spamsum_ctx* ctx); AARU_LOCAL void fuzzy_try_reduce_blockhash(spamsum_ctx* ctx);
AARU_LOCAL void fuzzy_try_fork_blockhash(spamsum_ctx* ctx); AARU_LOCAL void fuzzy_try_fork_blockhash(spamsum_ctx* ctx);
#endif // AARU_CHECKSUMS_NATIVE_SPAMSUM_H