OLD | NEW |
1 // It is important _not_ to put header guards here. | 1 // It is important _not_ to put header guards here. |
2 // This file will be intentionally included three times. | 2 // This file will be intentionally included three times. |
3 | 3 |
4 #if defined(SK4X_PREAMBLE) | 4 #if defined(SK4X_PREAMBLE) |
5 | 5 |
6 #elif defined(SK4X_PRIVATE) | 6 #elif defined(SK4X_PRIVATE) |
7 typedef T Type; | 7 typedef T Type; |
8 typedef T Vector[4]; | 8 typedef T Vector[4]; |
9 | 9 |
10 Vector fVec; | 10 Vector fVec; |
11 | 11 |
12 template <int m, int a, int s, int k> | 12 template <int m, int a, int s, int k> |
13 static Sk4x Shuffle(const Sk4x&, const Sk4x&); | 13 static Sk4x Shuffle(const Sk4x&, const Sk4x&); |
14 | 14 |
15 void set(const T vals[4]) { for (int i = 0; i < 4; i++) { fVec[i] = vals[i];
} } | 15 void set(const T vals[4]) { for (int i = 0; i < 4; i++) { fVec[i] = vals[i];
} } |
16 | 16 |
17 #else | 17 #else |
18 | 18 |
19 #define M(...) template <typename T> __VA_ARGS__ Sk4x<T>:: | 19 #define M(...) template <typename T> __VA_ARGS__ Sk4x<T>:: |
20 | 20 |
21 M() Sk4x() {} | 21 M() Sk4x() {} |
| 22 M() Sk4x(T v) { fVec[0] = fVec[1] = fVec[2] = fVec[3] = v; } |
22 M() Sk4x(T a, T b, T c, T d) { fVec[0] = a; fVec[1] = b; fVec[2] = c; fVec[3] =
d; } | 23 M() Sk4x(T a, T b, T c, T d) { fVec[0] = a; fVec[1] = b; fVec[2] = c; fVec[3] =
d; } |
23 | 24 |
24 M() Sk4x(const Sk4x<T>& other) { this->set(other.fVec);
} | 25 M() Sk4x(const Sk4x<T>& other) { this->set(other.fVec);
} |
25 M(Sk4x<T>&) operator=(const Sk4x<T>& other) { this->set(other.fVec); return *thi
s; } | 26 M(Sk4x<T>&) operator=(const Sk4x<T>& other) { this->set(other.fVec); return *thi
s; } |
26 | 27 |
27 M(Sk4x<T>) Load (const T vals[4]) { Sk4x r; r.set(vals); return r; } | 28 M(Sk4x<T>) Load (const T vals[4]) { Sk4x r; r.set(vals); return r; } |
28 M(Sk4x<T>) LoadAligned(const T vals[4]) { return Load(vals); } | 29 M(Sk4x<T>) LoadAligned(const T vals[4]) { return Load(vals); } |
29 | 30 |
30 M(void) store (T vals[4]) const { for (int i = 0; i < 4; i++) { vals[i] =
fVec[i]; } } | 31 M(void) store (T vals[4]) const { for (int i = 0; i < 4; i++) { vals[i] =
fVec[i]; } } |
31 M(void) storeAligned(T vals[4]) const { this->store(vals); } | 32 M(void) storeAligned(T vals[4]) const { this->store(vals); } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 k < 4 ? x.fVec[k] : y.fVec[k-4]); | 93 k < 4 ? x.fVec[k] : y.fVec[k-4]); |
93 } | 94 } |
94 | 95 |
95 M(Sk4x<T>) zwxy() const { return Shuffle<2,3,0,1>(*t
his, *this); } | 96 M(Sk4x<T>) zwxy() const { return Shuffle<2,3,0,1>(*t
his, *this); } |
96 M(Sk4x<T>) XYAB(const Sk4x& xyzw, const Sk4x& abcd) { return Shuffle<0,1,4,5>( x
yzw, abcd); } | 97 M(Sk4x<T>) XYAB(const Sk4x& xyzw, const Sk4x& abcd) { return Shuffle<0,1,4,5>( x
yzw, abcd); } |
97 M(Sk4x<T>) ZWCD(const Sk4x& xyzw, const Sk4x& abcd) { return Shuffle<2,3,6,7>( x
yzw, abcd); } | 98 M(Sk4x<T>) ZWCD(const Sk4x& xyzw, const Sk4x& abcd) { return Shuffle<2,3,6,7>( x
yzw, abcd); } |
98 | 99 |
99 #undef M | 100 #undef M |
100 | 101 |
101 #endif | 102 #endif |
OLD | NEW |