OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
operators.hpp
1#pragma once
2
3namespace gpu {
4
5template<typename type_t>
6struct less_t : public std::binary_function<type_t, type_t, bool> {
7 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
8 return a < b;
9 }
10};
11
12template<typename type_t>
13struct less_equal_t : public std::binary_function<type_t, type_t, bool> {
14 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
15 return a <= b;
16 }
17};
18
19template<typename type_t>
20struct greater_t : public std::binary_function<type_t, type_t, bool> {
21 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
22 return a > b;
23 }
24};
25
26template<typename type_t>
27struct greater_equal_t : public std::binary_function<type_t, type_t, bool> {
28 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
29 return a >= b;
30 }
31};
32
33template<typename type_t>
34struct equal_to_t : public std::binary_function<type_t, type_t, bool> {
35 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
36 return a == b;
37 }
38};
39
40template<typename type_t>
41struct not_equal_to_t : public std::binary_function<type_t, type_t, bool> {
42 __forceinline__ __device__ __host__ bool operator()(type_t a, type_t b) const {
43 return a != b;
44 }
45};
46
47template<typename type_t>
48struct plus_t : public std::binary_function<type_t, type_t, type_t> {
49 __forceinline__ __device__ __host__ type_t operator()(type_t a, type_t b) const {
50 return a + b;
51 }
52};
53
54template<typename type_t>
55struct minus_t : public std::binary_function<type_t, type_t, type_t> {
56 __forceinline__ __device__ __host__ type_t operator()(type_t a, type_t b) const {
57 return a - b;
58 }
59};
60
61template<typename type_t>
62struct multiplies_t : public std::binary_function<type_t, type_t, type_t> {
63 __forceinline__ __device__ __host__ type_t operator()(type_t a, type_t b) const {
64 return a * b;
65 }
66};
67
68template<typename type_t>
69struct maximum_t : public std::binary_function<type_t, type_t, type_t> {
70 __forceinline__ __device__ __host__ type_t operator()(type_t a, type_t b) const {
71 return (a < b) ? b : a;
72 }
73};
74
75template<typename type_t>
76struct minimum_t : public std::binary_function<type_t, type_t, type_t> {
77 __forceinline__ __device__ __host__ type_t operator()(type_t a, type_t b) const {
78 return (b < a) ? b : a;
79 }
80};
81
82}