Skip to content

Commit ebce2f1

Browse files
committed
Fix comp_return_type
1 parent 9fd6261 commit ebce2f1

1 file changed

Lines changed: 15 additions & 54 deletions

File tree

include/xsimd/arch/xsimd_neon.hpp

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -224,60 +224,21 @@ namespace xsimd
224224
**************************/
225225

226226
template <class T>
227-
struct comp_return_type_impl;
228-
229-
template <>
230-
struct comp_return_type_impl<uint8x16_t>
231-
{
232-
using type = uint8x16_t;
233-
};
234-
235-
template <>
236-
struct comp_return_type_impl<int8x16_t>
237-
{
238-
using type = uint8x16_t;
239-
};
240-
241-
template <>
242-
struct comp_return_type_impl<uint16x8_t>
243-
{
244-
using type = uint16x8_t;
245-
};
246-
247-
template <>
248-
struct comp_return_type_impl<int16x8_t>
249-
{
250-
using type = uint16x8_t;
251-
};
252-
253-
template <>
254-
struct comp_return_type_impl<uint32x4_t>
255-
{
256-
using type = uint32x4_t;
257-
};
258-
259-
template <>
260-
struct comp_return_type_impl<int32x4_t>
261-
{
262-
using type = uint32x4_t;
263-
};
264-
265-
template <>
266-
struct comp_return_type_impl<uint64x2_t>
267-
{
268-
using type = uint64x2_t;
269-
};
270-
271-
template <>
272-
struct comp_return_type_impl<int64x2_t>
273-
{
274-
using type = uint64x2_t;
275-
};
276-
277-
template <>
278-
struct comp_return_type_impl<float32x4_t>
279-
{
280-
using type = uint32x4_t;
227+
struct comp_return_type_impl
228+
{
229+
using type = typename std::conditional<
230+
std::is_same<T, uint8x16_t>::value || std::is_same<T, int8x16_t>::value,
231+
uint8x16_t,
232+
typename std::conditional<
233+
std::is_same<T, uint16x8_t>::value || std::is_same<T, int16x8_t>::value,
234+
uint16x8_t,
235+
typename std::conditional<
236+
std::is_same<T, uint32x4_t>::value || std::is_same<T, int32x4_t>::value || std::is_same<T, float32x4_t>::value,
237+
uint32x4_t,
238+
typename std::conditional<
239+
std::is_same<T, uint64x2_t>::value || std::is_same<T, int64x2_t>::value,
240+
uint64x2_t,
241+
T>::type>::type>::type>::type;
281242
};
282243

283244
template <class T>

0 commit comments

Comments
 (0)