1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-25 13:05:08 -07:00

Check _M_ARM64 in addition to __aarch64__

This commit is contained in:
Frank Denis 2023-08-05 23:04:35 +02:00
parent 5a8f528b81
commit e698b1b000
2 changed files with 4 additions and 4 deletions

View File

@ -154,7 +154,7 @@ sodium_crit_enter(void)
(void) nanosleep(&q, NULL); (void) nanosleep(&q, NULL);
# elif defined(__x86_64__) || defined(__i386__) # elif defined(__x86_64__) || defined(__i386__)
__asm__ __volatile__ ("pause":::"memory"); __asm__ __volatile__ ("pause":::"memory");
# elif defined(__aarch64__) # elif defined(__aarch64__) || defined(_M_ARM64)
__asm__ __volatile__ ("yield":::"memory"); __asm__ __volatile__ ("yield":::"memory");
# endif # endif
} }

View File

@ -64,12 +64,12 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
return -1; /* LCOV_EXCL_LINE */ return -1; /* LCOV_EXCL_LINE */
#endif #endif
#if defined(__ARM_NEON) || defined(__aarch64__) #if defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64)
cpu_features->has_neon = 1; cpu_features->has_neon = 1;
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON) #elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON)
cpu_features->has_neon = cpu_features->has_neon =
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0; (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
#elif defined(__aarch64__) && defined(AT_HWCAP) #elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
# ifdef HAVE_GETAUXVAL # ifdef HAVE_GETAUXVAL
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0; cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
# elif defined(HAVE_ELF_AUX_INFO) # elif defined(HAVE_ELF_AUX_INFO)
@ -118,7 +118,7 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES) #elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES)
cpu_features->has_armcrypto = cpu_features->has_armcrypto =
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0; (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0;
#elif defined(__aarch64__) && defined(AT_HWCAP) #elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
# ifdef HAVE_GETAUXVAL # ifdef HAVE_GETAUXVAL
cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0; cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
# elif defined(HAVE_ELF_AUX_INFO) # elif defined(HAVE_ELF_AUX_INFO)