55 #define OPH_DLL __declspec(dllexport) 57 #define OPH_DLL __attribute__((visibility("default"))) 82 v[0] = v_1; v[1] = v_2;
87 v[0] = a[0]; v[1] = a[1];
92 v[0] = a[0]; v[1] = a[1];
97 inline int& operator[] (
int i) {
return v[i]; }
98 inline const int& operator[] (
int i)
const {
return v[i]; }
99 inline int& operator() (
int i) {
return v[i % 2]; }
100 inline const int& operator() (
int i)
const {
return v[i % 2]; }
109 inline ivec2
operator + (
const ivec2& a,
const ivec2& b)
112 for (
int i = 0; i < 2; ++i) { c[i] = a[i] + b[i]; }
116 inline ivec2
operator + (
int a,
const ivec2& b)
119 for (
int i = 0; i < 2; ++i) { c[i] = a + b[i]; }
123 inline ivec2
operator + (
const ivec2& a,
int b)
126 for (
int i = 0; i < 2; ++i) { c[i] = a[i] + b; }
132 inline ivec2
operator - (
const ivec2& a,
const ivec2& b)
135 for (
int i = 0; i < 2; ++i) { c[i] = a[i] - b[i]; }
139 inline ivec2
operator - (
int a,
const ivec2& b)
142 for (
int i = 0; i < 2; ++i) { c[i] = a - b[i]; }
146 inline ivec2
operator - (
const ivec2& a,
int b)
149 for (
int i = 0; i < 2; ++i) { c[i] = a[i] - b; }
155 inline ivec2
operator * (
const ivec2& a,
const ivec2& b)
158 for (
int i = 0; i < 2; ++i) { c[i] = a[i] * b[i]; }
162 inline ivec2
operator * (
int a,
const ivec2& b)
165 for (
int i = 0; i < 2; ++i) { c[i] = a * b[i]; }
169 inline ivec2
operator * (
const ivec2& a,
int b)
172 for (
int i = 0; i < 2; ++i) { c[i] = a[i] * b; }
204 inline ivec2
operator += (ivec2& a,
const ivec2& b)
216 inline ivec2
operator -= (ivec2& a,
const ivec2& b)
228 inline ivec2
operator *= (ivec2& a,
const ivec2& b)
255 inline int operator == (
const ivec2& a,
const ivec2& b)
258 for (
int i = 0; i < 2; ++i) { c = c & (a[i] == b[i]); }
265 for (
int i = 0; i < 2; ++i) { c = c & (a == b[i]); }
272 for (
int i = 0; i < 2; ++i) { c = c & (a[i] == b); }
278 inline int operator < (
const ivec2& a,
const ivec2& b)
281 for (
int i = 0; i < 2; ++i) { c = c & (a[i] < b[i]); }
288 for (
int i = 0; i < 2; ++i) { c = c & (a < b[i]); }
295 for (
int i = 0; i < 2; ++i) { c = c & (a[i] < b); }
301 inline int operator <= (
const ivec2& a,
const ivec2& b)
304 for (
int i = 0; i < 2; ++i) { c = c & (a[i] <= b[i]); }
311 for (
int i = 0; i < 2; ++i) { c = c & (a <= b[i]); }
318 for (
int i = 0; i < 2; ++i) { c = c & (a[i] <= b); }
324 inline int operator > (
const ivec2& a,
const ivec2& b)
327 for (
int i = 0; i < 2; ++i) { c = c & (a[i] > b[i]); }
334 for (
int i = 0; i < 2; ++i) { c = c & (a > b[i]); }
341 for (
int i = 0; i < 2; ++i) { c = c & (a[i] > b); }
348 inline int operator >= (
const ivec2& a,
const ivec2& b)
351 for (
int i = 0; i < 2; ++i) { c = c & (a[i] >= b[i]); }
357 for (
int i = 0; i < 2; ++i) { c = c & (a >= b[i]); }
364 for (
int i = 0; i < 2; ++i) { c = c & (a[i] >= b); }
368 inline int operator != (
const ivec2& a,
const ivec2& b)
371 for (
int i = 0; i < 2; ++i) { c = c & (a[i] != b[i]); }
379 for (
int i = 0; i < 2; ++i) { c[i] = -a[i]; }
392 v[0] = v[1] = v[2] = 0;
397 v[0] = v[1] = v[2] = a;
400 inline ivec3(
int v_1,
int v_2,
int v_3)
402 v[0] = v_1; v[1] = v_2; v[2] = v_3;
407 v[0] = a[0]; v[1] = a[1]; v[2] = a[2];
412 v[0] = a[0]; v[1] = a[1]; v[2] = a[2];
417 inline int& operator[] (
int i) {
return v[i]; }
418 inline const int& operator[] (
int i)
const {
return v[i]; }
419 inline int& operator() (
int i) {
return v[i % 3]; }
420 inline const int& operator() (
int i)
const {
return v[i % 3]; }
424 inline ivec3
operator + (
const ivec3& a,
const ivec3& b)
427 for (
int i = 0; i < 3; ++i) { c[i] = a[i] + b[i]; }
431 inline ivec3
operator + (
int a,
const ivec3& b)
434 for (
int i = 0; i < 3; ++i) { c[i] = a + b[i]; }
438 inline ivec3
operator + (
const ivec3& a,
int b)
441 for (
int i = 0; i < 3; ++i) { c[i] = a[i] + b; }
447 inline ivec3
operator - (
const ivec3& a,
const ivec3& b)
450 for (
int i = 0; i < 3; ++i) { c[i] = a[i] - b[i]; }
454 inline ivec3
operator - (
int a,
const ivec3& b)
457 for (
int i = 0; i < 3; ++i) { c[i] = a - b[i]; }
461 inline ivec3
operator - (
const ivec3& a,
int b)
464 for (
int i = 0; i < 3; ++i) { c[i] = a[i] - b; }
470 inline ivec3
operator * (
const ivec3& a,
const ivec3& b)
473 for (
int i = 0; i < 3; ++i) { c[i] = a[i] * b[i]; }
477 inline ivec3
operator * (
int a,
const ivec3& b)
480 for (
int i = 0; i < 3; ++i) { c[i] = a * b[i]; }
484 inline ivec3
operator * (
const ivec3& a,
int b)
487 for (
int i = 0; i < 3; ++i) { c[i] = a[i] * b; }
519 inline ivec3
operator += (ivec3& a,
const ivec3& b)
531 inline ivec3
operator -= (ivec3& a,
const ivec3& b)
543 inline ivec3
operator *= (ivec3& a,
const ivec3& b)
570 inline int operator == (
const ivec3& a,
const ivec3& b)
573 for (
int i = 0; i < 3; ++i) { c = c & (a[i] == b[i]); }
580 for (
int i = 0; i < 3; ++i) { c = c & (a == b[i]); }
587 for (
int i = 0; i < 3; ++i) { c = c & (a[i] == b); }
593 inline int operator < (
const ivec3& a,
const ivec3& b)
596 for (
int i = 0; i < 3; ++i) { c = c & (a[i] < b[i]); }
603 for (
int i = 0; i < 3; ++i) { c = c & (a < b[i]); }
610 for (
int i = 0; i < 3; ++i) { c = c & (a[i] < b); }
616 inline int operator <= (
const ivec3& a,
const ivec3& b)
619 for (
int i = 0; i < 3; ++i) { c = c & (a[i] <= b[i]); }
626 for (
int i = 0; i < 3; ++i) { c = c & (a <= b[i]); }
633 for (
int i = 0; i < 3; ++i) { c = c & (a[i] <= b); }
639 inline int operator > (
const ivec3& a,
const ivec3& b)
642 for (
int i = 0; i < 3; ++i) { c = c & (a[i] > b[i]); }
649 for (
int i = 0; i < 3; ++i) { c = c & (a > b[i]); }
656 for (
int i = 0; i < 3; ++i) { c = c & (a[i] > b); }
662 inline int operator >= (
const ivec3& a,
const ivec3& b)
665 for (
int i = 0; i < 3; ++i) { c = c & (a[i] >= b[i]); }
672 for (
int i = 0; i < 3; ++i) { c = c & (a >= b[i]); }
679 for (
int i = 0; i < 3; ++i) { c = c & (a[i] >= b); }
683 inline int operator != (
const ivec3& a,
const ivec3& b)
686 for (
int i = 0; i < 3; ++i) { c = c & (a[i] != b[i]); }
694 for (
int i = 0; i < 3; ++i) { c[i] = -a[i]; }
707 v[0] = v[1] = v[2] = v[3] = 0;
712 v[0] = a; v[1] = a; v[2] = a; v[3] = a;
715 inline ivec4(
int v_1,
int v_2,
int v_3,
int v_4)
717 v[0] = v_1; v[1] = v_2; v[2] = v_3; v[3] = v_4;
722 v[0] = a[0]; v[1] = a[1]; v[2] = a[2]; v[3] = a[3];
727 v[0] = a[0]; v[1] = a[1]; v[2] = a[2]; v[3] = a[3];
732 inline int& operator[] (
int i) {
return v[i]; }
733 inline const int& operator[] (
int i)
const {
return v[i]; }
734 inline int& operator() (
int i) {
return v[i % 4]; }
735 inline const int& operator() (
int i)
const {
return v[i % 4]; }
744 inline ivec4
operator + (
const ivec4& a,
const ivec4& b)
747 for (
int i = 0; i < 4; ++i) { c[i] = a[i] + b[i]; }
751 inline ivec4
operator + (
int a,
const ivec4& b)
754 for (
int i = 0; i < 4; ++i) { c[i] = a + b[i]; }
758 inline ivec4
operator + (
const ivec4& a,
int b)
761 for (
int i = 0; i < 4; ++i) { c[i] = a[i] + b; }
767 inline ivec4
operator - (
const ivec4& a,
const ivec4& b)
770 for (
int i = 0; i < 4; ++i) { c[i] = a[i] - b[i]; }
774 inline ivec4
operator - (
int a,
const ivec4& b)
777 for (
int i = 0; i < 4; ++i) { c[i] = a - b[i]; }
781 inline ivec4
operator - (
const ivec4& a,
int b)
784 for (
int i = 0; i < 4; ++i) { c[i] = a[i] - b; }
790 inline ivec4
operator * (
const ivec4& a,
const ivec4& b)
793 for (
int i = 0; i < 4; ++i) { c[i] = a[i] * b[i]; }
797 inline ivec4
operator * (
int a,
const ivec4& b)
800 for (
int i = 0; i < 4; ++i) { c[i] = a * b[i]; }
804 inline ivec4
operator * (
const ivec4& a,
int b)
807 for (
int i = 0; i < 4; ++i) { c[i] = a[i] * b; }
839 inline ivec4
operator += (ivec4& a,
const ivec4& b)
851 inline ivec4
operator -= (ivec4& a,
const ivec4& b)
863 inline ivec4
operator *= (ivec4& a,
const ivec4& b)
890 inline int operator == (
const ivec4& a,
const ivec4& b)
893 for (
int i = 0; i < 4; ++i) { c = c & (a[i] == b[i]); }
900 for (
int i = 0; i < 4; ++i) { c = c & (a == b[i]); }
907 for (
int i = 0; i < 4; ++i) { c = c & (a[i] == b); }
913 inline int operator < (
const ivec4& a,
const ivec4& b)
916 for (
int i = 0; i < 4; ++i) { c = c & (a[i] < b[i]); }
923 for (
int i = 0; i < 4; ++i) { c = c & (a < b[i]); }
930 for (
int i = 0; i < 4; ++i) { c = c & (a[i] < b); }
936 inline int operator <= (
const ivec4& a,
const ivec4& b)
939 for (
int i = 0; i < 4; ++i) { c = c & (a[i] <= b[i]); }
946 for (
int i = 0; i < 4; ++i) { c = c & (a <= b[i]); }
953 for (
int i = 0; i < 4; ++i) { c = c & (a[i] <= b); }
959 inline int operator > (
const ivec4& a,
const ivec4& b)
962 for (
int i = 0; i < 4; ++i) { c = c & (a[i] > b[i]); }
969 for (
int i = 0; i < 4; ++i) { c = c & (a > b[i]); }
976 for (
int i = 0; i < 4; ++i) { c = c & (a[i] > b); }
982 inline int operator >= (
const ivec4& a,
const ivec4& b)
985 for (
int i = 0; i < 4; ++i) { c = c & (a[i] >= b[i]); }
989 inline int operator != (
const ivec4& a,
const ivec4& b)
992 for (
int i = 0; i < 4; ++i) { c = c & (a[i] != b[i]); }
999 for (
int i = 0; i < 4; ++i) { c = c & (a >= b[i]); }
1006 for (
int i = 0; i < 4; ++i) { c = c & (a[i] >= b); }
1016 for (
int i = 0; i < 4; ++i) { c[i] = -a[i]; }
ivec2 operator+=(ivec2 &a, const ivec2 &b)
ivec2 & operator=(const ivec2 &a)
ivec4(int v_1, int v_2, int v_3, int v_4)
ivec2 operator-(const ivec2 &a, const ivec2 &b)
ivec3(int v_1, int v_2, int v_3)
structure for 2-dimensional integer vector and its arithmetic.
int operator>=(const ivec2 &a, const ivec2 &b)
ivec3 & operator=(const ivec3 &a)
ivec2 operator+(const ivec2 &a, const ivec2 &b)
ivec2 operator*(const ivec2 &a, const ivec2 &b)
int operator<=(const ivec2 &a, const ivec2 &b)
structure for 4-dimensional integer vector and its arithmetic.
ivec2 operator-=(ivec2 &a, const ivec2 &b)
int operator>(const ivec2 &a, const ivec2 &b)
int operator!=(const ivec2 &a, const ivec2 &b)
int operator==(const ivec2 &a, const ivec2 &b)
structure for 3-dimensional integer vector and its arithmetic.
int operator<(const ivec2 &a, const ivec2 &b)
ivec4 & operator=(const ivec4 &a)
ivec2 operator*=(ivec2 &a, const ivec2 &b)