diff --git a/tiny_bvh.h b/tiny_bvh.h index 1b3af01..fb584a0 100644 --- a/tiny_bvh.h +++ b/tiny_bvh.h @@ -135,30 +135,9 @@ inline void* malloc64( size_t size, void* = nullptr ) } inline void free64( void* ptr, void* = nullptr ) { _aligned_free( ptr ); } } -#elif defined(__EMSCRIPTEN__) // EMSCRIPTEN - needs to be before gcc and clang to avoid misdetection +#else // EMSCRIPTEN / gcc / clang #define ALIGNED( x ) __attribute__( ( aligned( x ) ) ) -#if defined(__wasm_simd128__) || defined(__wasm_relaxed_simd__) -// https://emscripten.org/docs/porting/simd.html -#include -namespace tinybvh { -inline void* malloc64( size_t size, void* = nullptr ) -{ - return size == 0 ? 0 : _mm_malloc( size, 64 ); -} -inline void free64( void* ptr, void* = nullptr ) { _mm_free( ptr ); } -} -#else -namespace tinybvh { -inline void* malloc64( size_t size, void* = nullptr ) -{ - return size == 0 ? 0 : aligned_alloc( 64, make_multiple_64( size ) ); -} -inline void free64( void* ptr, void* = nullptr ) { free( ptr ); } -} -#endif -#else // gcc / clang -#define ALIGNED( x ) __attribute__( ( aligned( x ) ) ) -#if defined(__x86_64__) || defined(_M_X64) +#if defined(__x86_64__) || defined(_M_X64) || defined(__wasm_simd128__) || defined(__wasm_relaxed_simd__) #include namespace tinybvh { inline void* malloc64( size_t size, void* = nullptr ) diff --git a/tiny_ocl.h b/tiny_ocl.h index fc9e546..c0b9f46 100644 --- a/tiny_ocl.h +++ b/tiny_ocl.h @@ -55,30 +55,9 @@ inline void* malloc64( size_t size, void* = nullptr ) } inline void free64( void* ptr, void* = nullptr ) { _aligned_free( ptr ); } } -#elif defined(__EMSCRIPTEN__) // EMSCRIPTEN - needs to be before gcc and clang to avoid misdetection +#else // EMSCRIPTEN / gcc / clang #define ALIGNED( x ) __attribute__( ( aligned( x ) ) ) -#if defined(__wasm_simd128__) || defined(__wasm_relaxed_simd__) -// https://emscripten.org/docs/porting/simd.html -#include -namespace tinyocl { -inline void* malloc64( size_t size, void* = nullptr ) -{ - return size == 0 ? 0 : _mm_malloc( size, 64 ); -} -inline void free64( void* ptr, void* = nullptr ) { _mm_free( ptr ); } -} -#else -namespace tinyocl { -inline void* malloc64( size_t size, void* = nullptr ) -{ - return size == 0 ? 0 : aligned_alloc( 64, make_multiple_64( size ) ); -} -inline void free64( void* ptr, void* = nullptr ) { free( ptr ); } -} -#endif -#else // gcc / clang -#define ALIGNED( x ) __attribute__( ( aligned( x ) ) ) -#if defined(__x86_64__) || defined(_M_X64) +#if defined(__x86_64__) || defined(_M_X64) || defined(__wasm_simd128__) || defined(__wasm_relaxed_simd__) #include namespace tinyocl { inline void* malloc64( size_t size, void* = nullptr )