@@ -53,56 +53,11 @@ namespace Langulus::Math
53
53
: mMin {min}
54
54
, mMax {max} {}
55
55
56
- # if LANGULUS_SIMD(128BIT)
56
+ // / Create from registers
57
57
TEMPLATE () LANGULUS(INLINED)
58
- TME()::TRange(const simde__m128 & source) noexcept {
58
+ TME ()::TRange(const CT::SIMD auto & source) noexcept {
59
59
SIMD::Store (source, mArray );
60
60
}
61
-
62
- TEMPLATE () LANGULUS(INLINED)
63
- TME()::TRange(const simde__m128d& source) noexcept {
64
- SIMD::Store (source, mArray );
65
- }
66
-
67
- TEMPLATE () LANGULUS(INLINED)
68
- TME()::TRange(const simde__m128i& source) noexcept {
69
- SIMD::Store (source, mArray );
70
- }
71
- #endif
72
-
73
- #if LANGULUS_SIMD(256BIT)
74
- TEMPLATE () LANGULUS(INLINED)
75
- TME()::TRange(const simde__m256& source) noexcept {
76
- SIMD::Store (source, mArray );
77
- }
78
-
79
- TEMPLATE () LANGULUS(INLINED)
80
- TME()::TRange(const simde__m256d& source) noexcept {
81
- SIMD::Store (source, mArray );
82
- }
83
-
84
- TEMPLATE () LANGULUS(INLINED)
85
- TME()::TRange(const simde__m256i& source) noexcept {
86
- SIMD::Store (source, mArray );
87
- }
88
- #endif
89
-
90
- #if LANGULUS_SIMD(512BIT)
91
- TEMPLATE () LANGULUS(INLINED)
92
- TME()::TRange(const simde__m512& source) noexcept {
93
- SIMD::Store (source, mArray );
94
- }
95
-
96
- TEMPLATE () LANGULUS(INLINED)
97
- TME()::TRange(const simde__m512d& source) noexcept {
98
- SIMD::Store (source, mArray );
99
- }
100
-
101
- TEMPLATE () LANGULUS(INLINED)
102
- TME()::TRange(const simde__m512i& source) noexcept {
103
- SIMD::Store (source, mArray );
104
- }
105
- #endif
106
61
107
62
// / Construct from a descriptor
108
63
// / @param describe - the descriptor to scan
@@ -145,32 +100,30 @@ namespace Langulus::Math
145
100
// / @param r - the range to copy
146
101
// / @return a reference to this range
147
102
TEMPLATE () LANGULUS(INLINED)
148
- constexpr TME ()& TME()::operator = (const CT::RangeBased auto & r) noexcept {
103
+ constexpr auto TME ()::operator = (const CT::RangeBased auto & r) noexcept -> TRange& {
149
104
return *new (this ) TRange {DeintCast (r)};
150
105
}
151
106
152
107
// / Copy vector
153
108
// / @param v - the vector to copy
154
109
// / @return a reference to this range
155
110
TEMPLATE () LANGULUS(INLINED)
156
- constexpr TME ()& TME()::operator = (const CT::VectorBased auto & v) noexcept {
111
+ constexpr auto TME ()::operator = (const CT::VectorBased auto & v) noexcept -> TRange& {
157
112
return *new (this ) TRange {DeintCast (v)};
158
113
}
159
114
160
115
// / Copy scalar
161
116
// / @param s - the scalar value
162
117
// / @return a reference to this range
163
118
TEMPLATE () LANGULUS(INLINED)
164
- constexpr TME ()& TME()::operator = (const CT::ScalarBased auto & s) noexcept {
119
+ constexpr auto TME ()::operator = (const CT::ScalarBased auto & s) noexcept -> TRange& {
165
120
return *new (this ) TRange {DeintCast (s)};
166
121
}
167
122
168
123
// / Set only a specific component
169
124
// / @param c - the component to overwrite
170
125
// / @return a reference to this vector
171
- TEMPLATE ()
172
- template <CT::ScalarBased N, CT::Dimension D>
173
- LANGULUS (INLINED)
126
+ TEMPLATE () template <CT::ScalarBased N, CT::Dimension D> LANGULUS (INLINED)
174
127
constexpr auto& TME()::operator = (const TVectorComponent<N, D>& c) noexcept {
175
128
return *new (this ) TRange {PointType {c}};
176
129
}
@@ -195,36 +148,36 @@ namespace Langulus::Math
195
148
}
196
149
197
150
TEMPLATE () LANGULUS(INLINED)
198
- constexpr TME ()& TME()::Embrace(const auto & other) noexcept {
151
+ constexpr auto TME ()::Embrace(const auto & other) noexcept -> TRange& {
199
152
mMin = Min (mMin , other);
200
153
mMax = Max (mMax , other);
201
154
return *this ;
202
155
}
203
156
204
157
TEMPLATE () LANGULUS(INLINED)
205
- constexpr TME ()& TME()::ConstrainBy(const auto & limits) noexcept {
158
+ constexpr auto TME ()::ConstrainBy(const auto & limits) noexcept -> TRange& {
206
159
mMin = Clamp (mMin , limits.mMin , limits.mMax );
207
160
mMax = Clamp (mMax , limits.mMin , limits.mMax );
208
161
return *this ;
209
162
}
210
163
211
164
TEMPLATE () LANGULUS(INLINED)
212
- const typename TME ()::PointType& TME():: GetMin() const noexcept {
165
+ auto TME ()::GetMin() const noexcept -> const PointType& {
213
166
return mMin ;
214
167
}
215
168
216
169
TEMPLATE () LANGULUS(INLINED)
217
- const typename TME ()::PointType& TME():: GetMax() const noexcept {
170
+ auto TME ()::GetMax() const noexcept -> const PointType& {
218
171
return mMax ;
219
172
}
220
173
221
174
TEMPLATE () LANGULUS(INLINED)
222
- typename TME ()::PointType TME():: Length() const noexcept {
175
+ auto TME ()::Length() const noexcept -> PointType {
223
176
return mMax - mMin ;
224
177
}
225
178
226
179
TEMPLATE () LANGULUS(INLINED)
227
- typename TME ()::PointType TME():: Center() const noexcept {
180
+ auto TME ()::Center() const noexcept -> PointType {
228
181
return mMin + Length () * 0 .5f ;
229
182
}
230
183
@@ -244,25 +197,25 @@ namespace Langulus::Math
244
197
}
245
198
246
199
TEMPLATE () LANGULUS(INLINED)
247
- constexpr typename TME ()::PointType TME():: ClampRev(const PointType& pos) const noexcept {
200
+ constexpr auto TME ()::ClampRev(const PointType& pos) const noexcept -> PointType {
248
201
return pos.ClampRev (mMin , mMax );
249
202
}
250
203
251
204
TEMPLATE () LANGULUS(INLINED)
252
- constexpr typename TME ()::PointType TME():: Clamp(const PointType& pos) const noexcept {
205
+ constexpr auto TME ()::Clamp(const PointType& pos) const noexcept -> PointType {
253
206
return pos.Clamp (mMin , mMax );
254
207
}
255
208
256
209
TEMPLATE () LANGULUS(INLINED)
257
- constexpr TME () TME()::operator | (const TME ()& a) const noexcept {
210
+ constexpr auto TME ()::operator | (const TME ()& a) const noexcept -> TRange {
258
211
return {
259
212
mMin .Clamp (a.mMin , a.mMax ),
260
213
mMax .Clamp (a.mMin , a.mMax )
261
214
};
262
215
}
263
216
264
217
TEMPLATE () LANGULUS(INLINED)
265
- constexpr TME()& TME()::operator |= (const TME ()& a) noexcept {
218
+ constexpr auto TME()::operator |= (const TME ()& a) noexcept -> TRange& {
266
219
*this = *this | a;
267
220
}
268
221
@@ -273,12 +226,12 @@ namespace Langulus::Math
273
226
// / minX minY minZ ... maxX maxY maxZ ...
274
227
// / @returns a reference to the component
275
228
TEMPLATE () LANGULUS(INLINED)
276
- constexpr TypeOf<T>& TME()::operator [] (const Offset a) noexcept {
229
+ constexpr auto TME()::operator [] (const Offset a) noexcept -> MemberType& {
277
230
return mArray [a];
278
231
}
279
232
280
233
TEMPLATE () LANGULUS(INLINED)
281
- constexpr const TypeOf<T>& TME()::operator [] (const Offset a) const noexcept {
234
+ constexpr auto TME()::operator [] (const Offset a) const noexcept -> const MemberType& {
282
235
return mArray [a];
283
236
}
284
237
@@ -434,35 +387,31 @@ namespace Langulus::Math
434
387
// /
435
388
436
389
// / Add
437
- template <class T1 , class T2 >
438
- LANGULUS (INLINED)
390
+ template <class T1 , class T2 > LANGULUS (INLINED)
439
391
auto& operator += (TRange<T1>& me, const TRange<T2>& other) noexcept {
440
392
me.mMin += other.mMin ;
441
393
me.mMax += other.mMax ;
442
394
return me;
443
395
}
444
396
445
397
// / Subtract
446
- template <class T1 , class T2 >
447
- LANGULUS (INLINED)
398
+ template <class T1 , class T2 > LANGULUS (INLINED)
448
399
auto& operator -= (TRange<T1>& me, const TRange<T2>& other) noexcept {
449
400
me.mMin -= other.mMin ;
450
401
me.mMax -= other.mMax ;
451
402
return me;
452
403
}
453
404
454
405
// / Multiply
455
- template <class T1 , class T2 >
456
- LANGULUS (INLINED)
406
+ template <class T1 , class T2 > LANGULUS (INLINED)
457
407
auto& operator *= (TRange<T1>& me, const TRange<T2>& other) noexcept {
458
408
me.mMin *= other.mMin ;
459
409
me.mMax *= other.mMax ;
460
410
return me;
461
411
}
462
412
463
413
// / Divide
464
- template <class T1 , class T2 >
465
- LANGULUS (INLINED)
414
+ template <class T1 , class T2 > LANGULUS (INLINED)
466
415
auto& operator /= (TRange<T1>& me, const TRange<T2>& other) {
467
416
me.mMin /= other.mMin ;
468
417
me.mMax /= other.mMax ;
0 commit comments