Skip to content

Commit 1040fef

Browse files
WIP
1 parent e68ad27 commit 1040fef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ namespace xsimd
6666
template <class A, class T>
6767
XSIMD_INLINE batch<T, A> avgr(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
6868
#endif
69+
template <class A, class T>
70+
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
6971

7072
// abs
7173
template <class A>
@@ -103,13 +105,18 @@ namespace xsimd
103105
}
104106

105107
// avg
106-
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
108+
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
107109
XSIMD_INLINE batch<T, A> avg(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
108110
{
109111
constexpr auto nbit = 8 * sizeof(T) - 1;
110-
constexpr auto adj = ((self ^ other) << nbit) >> nbit;
112+
auto adj = ((self ^ other) << nbit) >> nbit;
111113
return avgr(self.data, other.data, A {}) - adj;
112114
}
115+
template <class A>
116+
XSIMD_INLINE batch<float, A> avg(batch<float, A> const& self, batch<float, A> const& other, requires_arch<altivec>) noexcept
117+
{
118+
return vec_avg(self.data, other.data);
119+
}
113120

114121
// batch_bool_cast
115122
template <class A, class T_out, class T_in>
@@ -613,7 +620,7 @@ namespace xsimd
613620
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
614621
XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<altivec>) noexcept
615622
{
616-
return vec_neg(self.data);
623+
return -(self.data);
617624
}
618625

619626
// neq

0 commit comments

Comments
 (0)