diff options
Diffstat (limited to 'intern/cycles/util/util_math_int3.h')
-rw-r--r-- | intern/cycles/util/util_math_int3.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math_int3.h b/intern/cycles/util/util_math_int3.h index 6eef8517665..81b10f31f4a 100644 --- a/intern/cycles/util/util_math_int3.h +++ b/intern/cycles/util/util_math_int3.h @@ -91,6 +91,24 @@ ccl_device_inline bool operator<(const int3 &a, const int3 &b) { return a.x < b.x && a.y < b.y && a.z < b.z; } + +ccl_device_inline int3 operator+(const int3 &a, const int3 &b) +{ +#ifdef __KERNEL_SSE__ + return int3(_mm_add_epi32(a.m128, b.m128)); +#else + return make_int3(a.x + b.x, a.y + b.y, a.z + b.z); +#endif +} + +ccl_device_inline int3 operator-(const int3 &a, const int3 &b) +{ +#ifdef __KERNEL_SSE__ + return int3(_mm_sub_epi32(a.m128, b.m128)); +#else + return make_int3(a.x - b.x, a.y - b.y, a.z - b.z); +#endif +} #endif /* !__KERNEL_OPENCL__ */ CCL_NAMESPACE_END |