File tree Expand file tree Collapse file tree 1 file changed +6
-43
lines changed
Expand file tree Collapse file tree 1 file changed +6
-43
lines changed Original file line number Diff line number Diff line change @@ -83,53 +83,16 @@ namespace xsimd
8383 using std::tgamma;
8484 using std::trunc;
8585
86- XSIMD_INLINE signed char abs (signed char v)
86+ template <typename T>
87+ XSIMD_INLINE constexpr typename std::enable_if<std::is_integral<T>::value && std::is_signed<T>::value, T>::type
88+ abs (T v) noexcept
8789 {
8890 return v < 0 ? -v : v;
8991 }
9092
91- namespace detail
92- {
93- // Use templated type here to prevent automatic instantiation that may
94- // ends up in a warning
95- template <typename char_type>
96- XSIMD_INLINE char abs (char_type v, std::true_type)
97- {
98- return v;
99- }
100- template <typename char_type>
101- XSIMD_INLINE char abs (char_type v, std::false_type)
102- {
103- return v < 0 ? -v : v;
104- }
105- }
106-
107- XSIMD_INLINE char abs (char v)
108- {
109- return detail::abs (v, std::is_unsigned<char >::type {});
110- }
111-
112- XSIMD_INLINE short abs (short v)
113- {
114- return v < 0 ? -v : v;
115- }
116- XSIMD_INLINE unsigned char abs (unsigned char v)
117- {
118- return v;
119- }
120- XSIMD_INLINE unsigned short abs (unsigned short v)
121- {
122- return v;
123- }
124- XSIMD_INLINE unsigned int abs (unsigned int v)
125- {
126- return v;
127- }
128- XSIMD_INLINE unsigned long abs (unsigned long v)
129- {
130- return v;
131- }
132- XSIMD_INLINE unsigned long long abs (unsigned long long v)
93+ template <typename T>
94+ XSIMD_INLINE constexpr typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value, T>::type
95+ abs (T v) noexcept
13396 {
13497 return v;
13598 }
You can’t perform that action at this time.
0 commit comments