mirror of
https://github.com/aaru-dps/Aaru.Checksums.Native.git
synced 2025-12-16 11:14:29 +00:00
Add SSSE3 implementation for Adler32.
This commit is contained in:
12
adler32.c
12
adler32.c
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "library.h"
|
||||
#include "adler32.h"
|
||||
#include "simd.h"
|
||||
|
||||
AARU_EXPORT adler32_ctx* AARU_CALL adler32_init()
|
||||
{
|
||||
@@ -48,8 +49,19 @@ AARU_EXPORT int AARU_CALL adler32_update(adler32_ctx* ctx, const uint8_t* data,
|
||||
{
|
||||
if(!ctx || !data) return -1;
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
|
||||
defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
|
||||
if(have_ssse3())
|
||||
{
|
||||
adler32_ssse3(&ctx->sum1, &ctx->sum2, data, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t sum1 = ctx->sum1;
|
||||
uint32_t sum2 = ctx->sum2;
|
||||
|
||||
unsigned n;
|
||||
|
||||
/* in case user likes doing a byte at a time, keep it fast */
|
||||
|
||||
Reference in New Issue
Block a user