1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2017 Denis Demidov <dennis.demidov@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 // size_t and ptrdiff_t need special treatment on OSX since those are not
12 // typedefs for ulong and long here:
13 #if defined(__APPLE__) && !defined(BOOST_COMPUTE_TYPES_SIZE_T_HPP)
14 #define BOOST_COMPUTE_TYPES_SIZE_T_HPP
18 #include <boost/mpl/if.hpp>
20 #include <boost/compute/type_traits/is_fundamental.hpp>
21 #include <boost/compute/type_traits/type_name.hpp>
22 #include <boost/compute/detail/meta_kernel.hpp>
27 template <> struct is_fundamental<size_t> : boost::true_type {};
28 template <> struct is_fundamental<ptrdiff_t> : boost::true_type {};
32 template <> struct type_name_trait<size_t>
34 boost::mpl::if_c<sizeof(size_t) == sizeof(cl_uint), cl_uint, cl_ulong>::type
38 template <> struct type_name_trait<ptrdiff_t>
40 boost::mpl::if_c<sizeof(ptrdiff_t) == sizeof(cl_int), cl_int, cl_long>::type
44 inline meta_kernel& operator<<(meta_kernel &k, size_t v) {
50 inline meta_kernel& operator<<(meta_kernel &k, ptrdiff_t v) {
56 } // end detail namespace
57 } // end compute namespace
58 } // end boost namespace