23 #include "skinny-internal.h"
26 #if defined(__x86_64) || defined(__x86_64__) || \
27 defined(__i386) || defined(__i386__)
32 #if SKINNY_X86 && (defined(__GNUC__) || defined(__clang__))
33 #define SKINNY_X86_CPUID 1
35 #define SKINNY_X86_CPUID 0
41 int _skinny_has_vec128(
void)
44 #if SKINNY_VEC128_MATH
45 #if SKINNY_X86_CPUID && defined(__SSE2__)
51 __cpuid(1, eax, ebx, ecx, edx);
52 detected = (edx & (1 << 26)) != 0;
53 #elif defined(__arm) || defined(__arm__)
54 #if defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(__ARM_NEON_FP)
64 int _skinny_has_vec256(
void)
67 #if SKINNY_VEC256_MATH
68 #if SKINNY_X86_CPUID && defined(__AVX2__)
74 __cpuid(7, eax, ebx, ecx, edx);
75 detected = (ebx & (1 << 5)) != 0;
81 void *skinny_calloc(
size_t size,
void **base_ptr)
85 void *ptr = calloc(1, size + 31);
88 ptr = (
void *)((((uintptr_t)ptr) + 31) & ~((uintptr_t)31));