Blender  V3.3
math_int2.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_MATH_INT2_H__
5 #define __UTIL_MATH_INT2_H__
6 
7 #ifndef __UTIL_MATH_H__
8 # error "Do not include this file directly, include util/types.h instead."
9 #endif
10 
12 
13 /*******************************************************************************
14  * Declaration.
15  */
16 
17 #if !defined(__KERNEL_METAL__)
18 ccl_device_inline bool operator==(const int2 a, const int2 b);
19 ccl_device_inline int2 operator+(const int2 &a, const int2 &b);
21 ccl_device_inline int2 operator-(const int2 &a, const int2 &b);
22 ccl_device_inline int2 operator*(const int2 &a, const int2 &b);
23 ccl_device_inline int2 operator/(const int2 &a, const int2 &b);
24 #endif /* !__KERNEL_METAL__ */
25 
26 /*******************************************************************************
27  * Definition.
28  */
29 
30 #if !defined(__KERNEL_METAL__)
32 {
33  return (a.x == b.x && a.y == b.y);
34 }
35 
37 {
38  return make_int2(a.x + b.x, a.y + b.y);
39 }
40 
42 {
43  return a = a + b;
44 }
45 
47 {
48  return make_int2(a.x - b.x, a.y - b.y);
49 }
50 
52 {
53  return make_int2(a.x * b.x, a.y * b.y);
54 }
55 
57 {
58  return make_int2(a.x / b.x, a.y / b.y);
59 }
60 #endif /* !__KERNEL_METAL__ */
61 
63 
64 #endif /* __UTIL_MATH_INT2_H__ */
#define ccl_device_inline
Definition: cuda/compat.h:34
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
CCL_NAMESPACE_BEGIN ccl_device_inline bool operator==(const int2 a, const int2 b)
Definition: math_int2.h:31
ccl_device_inline int2 operator*(const int2 &a, const int2 &b)
Definition: math_int2.h:51
ccl_device_inline int2 operator/(const int2 &a, const int2 &b)
Definition: math_int2.h:56
ccl_device_inline int2 operator-(const int2 &a, const int2 &b)
Definition: math_int2.h:46
ccl_device_inline int2 operator+=(int2 &a, const int2 &b)
Definition: math_int2.h:41
ccl_device_inline int2 operator+(const int2 &a, const int2 &b)
Definition: math_int2.h:36
#define make_int2(x, y)
Definition: metal/compat.h:206
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)