1/* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt>
2
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6*/
7
8#ifndef LIBSIMDPP_SIMDPP_DETAIL_TRAITS_H
9#define LIBSIMDPP_SIMDPP_DETAIL_TRAITS_H
10
11#ifndef LIBSIMDPP_SIMD_H
12 #error "This file must be included through simd.h"
13#endif
14
15#include <simdpp/types.h>
16
17namespace simdpp {
18namespace SIMDPP_ARCH_NAMESPACE {
19namespace detail {
20
21/* Normalizes vector type. Removes sign from a vector type.
22 */
23template<class V> struct remove_sign { using type = V; using expr = V; };
24
25template<unsigned N, class E>
26struct remove_sign<int8<N,E>> { using type = uint8<N>; using expr = uint8<N,E>; };
27template<unsigned N, class E>
28struct remove_sign<int16<N,E>> { using type = uint16<N>; using expr = uint16<N,E>; };
29template<unsigned N, class E>
30struct remove_sign<int32<N,E>> { using type = uint32<N>; using expr = uint32<N,E>; };
31template<unsigned N, class E>
32struct remove_sign<int64<N,E>> { using type = uint64<N>; using expr = uint64<N,E>; };
33
34/* Normalizes vector type. Removes sign from a vector type. Result type is a
35 value type, not an expression.
36 */
37template<class V> struct remove_mask { using type = V; using expr = V; };
38
39template<unsigned N, class E>
40struct remove_mask<mask_int8<N,E>> { using type = uint8<N>; using expr = uint8<N,E>; };
41template<unsigned N, class E>
42struct remove_mask<mask_int16<N,E>> { using type = uint16<N>; using expr = uint16<N,E>; };
43template<unsigned N, class E>
44struct remove_mask<mask_int32<N,E>> { using type = uint32<N>; using expr = uint32<N,E>; };
45template<unsigned N, class E>
46struct remove_mask<mask_int64<N,E>> { using type = uint64<N>; using expr = uint64<N,E>; };
47template<unsigned N, class E>
48struct remove_mask<mask_float32<N,E>> { using type = float32<N>; using expr = float32<N,E>; };
49template<unsigned N, class E>
50struct remove_mask<mask_float64<N,E>> { using type = float64<N>; using expr = float64<N,E>; };
51
52} // namespace detail
53} // namespace SIMDPP_ARCH_NAMESPACE
54} // namespace simdpp
55
56#endif
57