diff options
| author | a1xd <[email protected]> | 2021-04-08 02:30:01 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-04-08 02:30:01 -0400 |
| commit | c55d1bfd01147fa014ac07d4b03ef3cad8427ae6 (patch) | |
| tree | 39ffa4a79bc6b019443521f10203f787c4b98698 /common/utility.hpp | |
| parent | unmark fill as const (diff) | |
| download | rawaccel-c55d1bfd01147fa014ac07d4b03ef3cad8427ae6.tar.xz rawaccel-c55d1bfd01147fa014ac07d4b03ef3cad8427ae6.zip | |
optimize a bit/refactor modify
Diffstat (limited to 'common/utility.hpp')
| -rw-r--r-- | common/utility.hpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/common/utility.hpp b/common/utility.hpp index a8e5f83..cbd19e3 100644 --- a/common/utility.hpp +++ b/common/utility.hpp @@ -1,24 +1,7 @@ #pragma once -#ifdef _MANAGED -#include <math.h> -#else -#include <emmintrin.h> -#endif - namespace rawaccel { -#ifdef _MANAGED - inline double sqrtsd(double val) { return sqrt(val); } -#else - inline double sqrtsd(double val) { - __m128d src = _mm_load_sd(&val); - __m128d dst = _mm_sqrt_sd(src, src); - _mm_store_sd(&val, dst); - return val; - } -#endif - constexpr double minsd(double a, double b) { return (a < b) ? a : b; @@ -92,4 +75,14 @@ namespace rawaccel { template <typename T> using remove_ref_t = typename remove_ref<T>::type; + + template <typename T, typename U> + struct is_same { static constexpr bool value = false; }; + + template <typename T> + struct is_same<T, T> { static constexpr bool value = true; }; + + template <typename T, typename U> + inline constexpr bool is_same_v = is_same<T, U>::value; + } |