Blender  V2.93
util_math_int2.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2017 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __UTIL_MATH_INT2_H__
18 #define __UTIL_MATH_INT2_H__
19 
20 #ifndef __UTIL_MATH_H__
21 # error "Do not include this file directly, include util_types.h instead."
22 #endif
23 
25 
26 /*******************************************************************************
27  * Declaration.
28  */
29 
30 #ifndef __KERNEL_OPENCL__
31 ccl_device_inline bool operator==(const int2 a, const int2 b);
32 ccl_device_inline int2 operator+(const int2 &a, const int2 &b);
34 ccl_device_inline int2 operator-(const int2 &a, const int2 &b);
35 ccl_device_inline int2 operator*(const int2 &a, const int2 &b);
36 ccl_device_inline int2 operator/(const int2 &a, const int2 &b);
37 #endif /* !__KERNEL_OPENCL__ */
38 
39 /*******************************************************************************
40  * Definition.
41  */
42 
43 #ifndef __KERNEL_OPENCL__
44 ccl_device_inline bool operator==(const int2 a, const int2 b)
45 {
46  return (a.x == b.x && a.y == b.y);
47 }
48 
50 {
51  return make_int2(a.x + b.x, a.y + b.y);
52 }
53 
55 {
56  return a = a + b;
57 }
58 
60 {
61  return make_int2(a.x - b.x, a.y - b.y);
62 }
63 
65 {
66  return make_int2(a.x * b.x, a.y * b.y);
67 }
68 
70 {
71  return make_int2(a.x / b.x, a.y / b.y);
72 }
73 #endif /* !__KERNEL_OPENCL__ */
74 
76 
77 #endif /* __UTIL_MATH_INT2_H__ */
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_int2(x, y)
static unsigned a[3]
Definition: RandGen.cpp:92
CCL_NAMESPACE_BEGIN ccl_device_inline bool operator==(const int2 a, const int2 b)
ccl_device_inline int2 operator*(const int2 &a, const int2 &b)
ccl_device_inline int2 operator/(const int2 &a, const int2 &b)
ccl_device_inline int2 operator-(const int2 &a, const int2 &b)
ccl_device_inline int2 operator+=(int2 &a, const int2 &b)
ccl_device_inline int2 operator+(const int2 &a, const int2 &b)