mirror of
https://github.com/aaru-dps/Aaru.Checksums.Native.git
synced 2025-12-16 11:14:29 +00:00
Refactor code.
This commit is contained in:
@@ -26,13 +26,13 @@
|
||||
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
|
||||
|
||||
#include <arm_neon.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "library.h"
|
||||
#include "arm_vmull.h"
|
||||
#include "crc32.h"
|
||||
#include "crc32_simd.h"
|
||||
#include "arm_vmull.h"
|
||||
|
||||
/*
|
||||
* somewhat surprisingly the "naive" way of doing this, ie. with a flag and a cond. branch,
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
|
||||
|
||||
#include <arm_neon.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "library.h"
|
||||
#include "arm_vmull.h"
|
||||
|
||||
13
simd.c
13
simd.c
@@ -112,6 +112,7 @@ int have_avx2(void)
|
||||
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
#include <processthreadsapi.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <sys/sysctl.h>
|
||||
@@ -125,11 +126,9 @@ int have_neon_apple()
|
||||
{
|
||||
int value;
|
||||
size_t len = sizeof(int);
|
||||
int ret=
|
||||
sysctlbyname("hw.optional.neon", &value, &len, NULL, 0);
|
||||
int ret = sysctlbyname("hw.optional.neon", &value, &len, NULL, 0);
|
||||
|
||||
if(ret != 0)
|
||||
return 0;
|
||||
if(ret != 0) return 0;
|
||||
|
||||
return value == 1;
|
||||
}
|
||||
@@ -138,11 +137,9 @@ int have_crc32_apple()
|
||||
{
|
||||
int value;
|
||||
size_t len = sizeof(int);
|
||||
int ret=
|
||||
sysctlbyname("hw.optional.crc32", &value, &len, NULL, 0);
|
||||
int ret = sysctlbyname("hw.optional.crc32", &value, &len, NULL, 0);
|
||||
|
||||
if(ret != 0)
|
||||
return 0;
|
||||
if(ret != 0) return 0;
|
||||
|
||||
return value == 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user