Refactor code.

This commit is contained in:
2021-10-13 03:46:47 +01:00
parent ca65d12c7e
commit 58f97a93f3
10 changed files with 103 additions and 106 deletions

View File

@@ -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,

View File

@@ -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
View File

@@ -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;
}