]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/compute/include/boost/compute/type_traits/scalar_type.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / type_traits / scalar_type.hpp
CommitLineData
7c673cae
FG
1//---------------------------------------------------------------------------//
2// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// See http://boostorg.github.com/compute for more information.
9//---------------------------------------------------------------------------//
10
11#ifndef BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP
12#define BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP
13
14#include <boost/preprocessor/cat.hpp>
15
16#include <boost/compute/types/fundamental.hpp>
17
18namespace boost {
19namespace compute {
20
21/// Meta-function returning the scalar type for a vector type.
22///
23/// For example,
24/// \code
25/// scalar_type<float4_>::type == float
26/// \endcode
27template<class Vector>
28struct scalar_type
29{
30 /// \internal_
31 typedef void type;
32};
33
34/// \internal_
35#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \
36 template<> \
37 struct scalar_type<BOOST_PP_CAT(scalar, _)> \
38 { \
39 typedef BOOST_PP_CAT(scalar, _) type; \
40 };
41
42/// \internal_
43#define BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, size) \
44 template<> \
45 struct scalar_type<BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _)> \
46 { \
47 typedef BOOST_PP_CAT(scalar, _) type; \
48 };
49
50/// \internal_
51#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(scalar) \
52 BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \
53 BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 2) \
54 BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 4) \
55 BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 8) \
56 BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 16)
57
58BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(char)
59BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uchar)
60BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(short)
61BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ushort)
62BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(int)
63BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uint)
64BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(long)
65BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ulong)
66BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(float)
67BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(double)
68
69} // end compute namespace
70} // end boost namespace
71
72#endif // BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP