| 1 | #ifndef CUDIFY_HARDWARE_COMMON_HPP_ | 
| 2 | #define CUDIFY_HARDWARE_COMMON_HPP_ | 
| 3 |  | 
| 4 |  | 
| 5 | #include <initializer_list> | 
| 6 |  | 
| 7 | #ifdef CUDA_ON_CPU | 
| 8 |  | 
| 9 | struct uint3 | 
| 10 | { | 
| 11 |     unsigned int x, y, z; | 
| 12 | }; | 
| 13 |  | 
| 14 | struct dim3 | 
| 15 | { | 
| 16 |     unsigned int x, y, z; | 
| 17 |  | 
| 18 |     constexpr dim3(unsigned int vx = 1, unsigned int vy = 1, unsigned int vz = 1) : x(vx), y(vy), z(vz) {} | 
| 19 |     constexpr dim3(uint3 v) : x(v.x), y(v.y), z(v.z) {} | 
| 20 |     constexpr operator uint3(void) const { return uint3{x, y, z}; } | 
| 21 |  | 
| 22 |     constexpr dim3(const dim3 & d) : x(d.x), y(d.y), z(d.z) {} | 
| 23 |  | 
| 24 |     template<typename T> | 
| 25 |     constexpr dim3(const std::initializer_list<T> & list)  | 
| 26 |     { | 
| 27 |         auto it = list.begin(); | 
| 28 |  | 
| 29 |         x = *it; | 
| 30 |         ++it; | 
| 31 |         y = *it; | 
| 32 |         ++it; | 
| 33 |         z = *it; | 
| 34 |     } | 
| 35 | }; | 
| 36 |  | 
| 37 | #endif | 
| 38 |  | 
| 39 | #endif |