Skip to content

Commit 7933df6

Browse files
Fix overload of abs for char type
1 parent fa1890e commit 7933df6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

include/xsimd/arch/xsimd_scalar.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,24 @@ namespace xsimd
9090
{
9191
return v < 0 ? -v : v;
9292
}
93+
94+
namespace detail
95+
{
96+
inline char abs(char v, std::true_type)
97+
{
98+
return v;
99+
}
100+
inline char abs(char v, std::false_type)
101+
{
102+
return v < 0 ? -v : v;
103+
}
104+
}
105+
93106
inline char abs(char v)
94107
{
95-
return v < 0 ? -v : v;
108+
return detail::abs(v, std::is_unsigned<char>::type {});
96109
}
110+
97111
inline short abs(short v)
98112
{
99113
return v < 0 ? -v : v;

0 commit comments

Comments
 (0)