2
0
mirror of https://github.com/boostorg/compute.git synced 2026-02-19 14:22:12 +00:00

Rename types/builtin.hpp to types/fundamental.hpp

This commit is contained in:
Kyle Lutz
2014-12-20 13:34:27 -08:00
parent 7c957831c3
commit c97c83a562
41 changed files with 198 additions and 186 deletions

View File

@@ -13,7 +13,7 @@
#include <boost/compute/algorithm/reduce.hpp>
#include <boost/compute/iterator/transform_iterator.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -12,7 +12,7 @@
#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_FIND_EXTREMA_HPP
#include <boost/compute/command_queue.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/container/detail/scalar.hpp>

View File

@@ -17,7 +17,7 @@
#include <boost/compute/algorithm/transform_reduce.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/functional/integer.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -11,7 +11,7 @@
#ifndef BOOST_COMPUTE_CONTAINER_STRING_HPP
#define BOOST_COMPUTE_CONTAINER_STRING_HPP
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/container/basic_string.hpp>
namespace boost {

View File

@@ -19,7 +19,7 @@
#include <boost/compute/config.hpp>
#include <boost/compute/exception.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/detail/assert_cl_success.hpp>

View File

@@ -18,7 +18,7 @@
#include <boost/compute/detail/duration.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/detail/assert_cl_success.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -12,7 +12,7 @@
#define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <cstddef>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/type_traits/scalar_type.hpp>
namespace boost {

View File

@@ -12,7 +12,7 @@
#define BOOST_COMPUTE_FUNCTIONAL_HASH_HPP
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <vtkMatrix4x4.h>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <boost/compute/command_queue.hpp>
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
namespace boost {

View File

@@ -13,7 +13,7 @@
#include <boost/compute/command_queue.hpp>
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/algorithm/accumulate.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/algorithm/transform.hpp>

View File

@@ -15,7 +15,7 @@
#include <boost/compute/command_queue.hpp>
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/type_traits/make_vector_type.hpp>
namespace boost {

View File

@@ -14,7 +14,7 @@
#include <boost/compute/command_queue.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/algorithm/copy_if.hpp>
#include <boost/compute/algorithm/transform.hpp>

View File

@@ -13,7 +13,7 @@
#include <boost/compute/command_queue.hpp>
#include <boost/compute/function.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <boost/type_traits/common_type.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {

View File

@@ -11,7 +11,7 @@
#ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP
#define BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -14,7 +14,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -13,7 +13,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
namespace boost {
namespace compute {

View File

@@ -15,8 +15,8 @@
///
/// Meta-header to include all Boost.Compute types headers.
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/complex.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/types/pair.hpp>
#include <boost/compute/types/struct.hpp>
#include <boost/compute/types/tuple.hpp>

View File

@@ -1,5 +1,5 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
@@ -8,149 +8,5 @@
// See http://kylelutz.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_TYPES_BUILTIN_HPP
#define BOOST_COMPUTE_TYPES_BUILTIN_HPP
#include <cstring>
#include <ostream>
#include <boost/preprocessor.hpp>
#include <boost/compute/cl.hpp>
namespace boost {
namespace compute {
// scalar data types
typedef cl_char char_;
typedef cl_uchar uchar_;
typedef cl_short short_;
typedef cl_ushort ushort_;
typedef cl_int int_;
typedef cl_uint uint_;
typedef cl_long long_;
typedef cl_ulong ulong_;
typedef cl_float float_;
typedef cl_double double_;
// converts uchar to ::boost::compute::uchar_
#define BOOST_COMPUTE_MAKE_SCALAR_TYPE(scalar) \
BOOST_PP_CAT(::boost::compute::scalar, _)
// converts float, 4 to ::boost::compute::float4_
#define BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) \
BOOST_PP_CAT(BOOST_PP_CAT(::boost::compute::scalar, size), _)
// vector data types
template<class Scalar, size_t N>
class vector_type
{
public:
typedef Scalar scalar_type;
vector_type()
{
}
vector_type(const vector_type<Scalar, N> &other)
{
std::memcpy(m_value, other.m_value, sizeof(m_value));
}
vector_type<Scalar, N>&
operator=(const vector_type<Scalar, N> &other)
{
std::memcpy(m_value, other.m_value, sizeof(m_value));
return *this;
}
size_t size() const
{
return N;
}
Scalar& operator[](size_t i)
{
return m_value[i];
}
Scalar operator[](size_t i) const
{
return m_value[i];
}
bool operator==(const vector_type<Scalar, N> &other) const
{
return std::memcmp(m_value, other.m_value, sizeof(m_value)) == 0;
}
bool operator!=(const vector_type<Scalar, N> &other) const
{
return !(*this == other);
}
protected:
scalar_type m_value[N];
};
#define BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION(z, i, _) \
BOOST_PP_COMMA_IF(i) scalar_type BOOST_PP_CAT(arg, i)
#define BOOST_COMPUTE_VECTOR_TYPE_DECLARE_CTOR_ARGS(scalar, size) \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _)
#define BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG(z, i, _) \
m_value[i] = BOOST_PP_CAT(arg, i);
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(cl_scalar, size, class_name) \
class class_name : public vector_type<cl_scalar, size> \
{ \
public: \
class_name() { } \
class_name( \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _) \
) \
{ \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG, _) \
} \
};
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, size) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(BOOST_PP_CAT(cl_, scalar), \
size, \
BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _)) \
\
inline std::ostream& operator<<( \
std::ostream &s, \
const BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) &v) \
{ \
s << BOOST_PP_STRINGIZE(BOOST_PP_CAT(scalar, size)) << "("; \
for(size_t i = 0; i < size; i++){\
s << v[i]; \
if(i != size - 1){\
s << ", "; \
} \
} \
s << ")"; \
return s; \
}
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPES(scalar) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 2) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 4) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 8) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 16) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(char)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uchar)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(short)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ushort)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(int)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uint)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(long)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ulong)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(float)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(double)
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_TYPES_BUILTIN_HPP
// deprecated, use <boost/compute/types/fundamental.hpp> instead
#include <boost/compute/types/fundamental.hpp>

View File

@@ -14,7 +14,7 @@
#include <complex>
#include <boost/compute/functional.hpp>
#include <boost/compute/types/builtin.hpp>
#include <boost/compute/types/fundamental.hpp>
#include <boost/compute/type_traits/make_vector_type.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/detail/meta_kernel.hpp>

View File

@@ -0,0 +1,156 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://kylelutz.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP
#define BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP
#include <cstring>
#include <ostream>
#include <boost/preprocessor.hpp>
#include <boost/compute/cl.hpp>
namespace boost {
namespace compute {
// scalar data types
typedef cl_char char_;
typedef cl_uchar uchar_;
typedef cl_short short_;
typedef cl_ushort ushort_;
typedef cl_int int_;
typedef cl_uint uint_;
typedef cl_long long_;
typedef cl_ulong ulong_;
typedef cl_float float_;
typedef cl_double double_;
// converts uchar to ::boost::compute::uchar_
#define BOOST_COMPUTE_MAKE_SCALAR_TYPE(scalar) \
BOOST_PP_CAT(::boost::compute::scalar, _)
// converts float, 4 to ::boost::compute::float4_
#define BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) \
BOOST_PP_CAT(BOOST_PP_CAT(::boost::compute::scalar, size), _)
// vector data types
template<class Scalar, size_t N>
class vector_type
{
public:
typedef Scalar scalar_type;
vector_type()
{
}
vector_type(const vector_type<Scalar, N> &other)
{
std::memcpy(m_value, other.m_value, sizeof(m_value));
}
vector_type<Scalar, N>&
operator=(const vector_type<Scalar, N> &other)
{
std::memcpy(m_value, other.m_value, sizeof(m_value));
return *this;
}
size_t size() const
{
return N;
}
Scalar& operator[](size_t i)
{
return m_value[i];
}
Scalar operator[](size_t i) const
{
return m_value[i];
}
bool operator==(const vector_type<Scalar, N> &other) const
{
return std::memcmp(m_value, other.m_value, sizeof(m_value)) == 0;
}
bool operator!=(const vector_type<Scalar, N> &other) const
{
return !(*this == other);
}
protected:
scalar_type m_value[N];
};
#define BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION(z, i, _) \
BOOST_PP_COMMA_IF(i) scalar_type BOOST_PP_CAT(arg, i)
#define BOOST_COMPUTE_VECTOR_TYPE_DECLARE_CTOR_ARGS(scalar, size) \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _)
#define BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG(z, i, _) \
m_value[i] = BOOST_PP_CAT(arg, i);
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(cl_scalar, size, class_name) \
class class_name : public vector_type<cl_scalar, size> \
{ \
public: \
class_name() { } \
class_name( \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _) \
) \
{ \
BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG, _) \
} \
};
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, size) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(BOOST_PP_CAT(cl_, scalar), \
size, \
BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _)) \
\
inline std::ostream& operator<<( \
std::ostream &s, \
const BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) &v) \
{ \
s << BOOST_PP_STRINGIZE(BOOST_PP_CAT(scalar, size)) << "("; \
for(size_t i = 0; i < size; i++){\
s << v[i]; \
if(i != size - 1){\
s << ", "; \
} \
} \
s << ")"; \
return s; \
}
#define BOOST_COMPUTE_DECLARE_VECTOR_TYPES(scalar) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 2) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 4) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 8) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 16) \
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(char)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uchar)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(short)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ushort)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(int)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uint)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(long)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ulong)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(float)
BOOST_COMPUTE_DECLARE_VECTOR_TYPES(double)
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP