🧑‍💻 Min and max for base types

This commit is contained in:
Scott Lahteine 2022-10-10 17:51:33 -04:00
parent 0203e32c73
commit 3c870f2d4b

View File

@ -347,6 +347,10 @@ struct XYval {
FI operator T* () { return pos; } FI operator T* () { return pos; }
// If any element is true then it's true // If any element is true then it's true
FI operator bool() { return x || y; } FI operator bool() { return x || y; }
// Smallest element
FI T _min() const { return _MIN(x, y); }
// Largest element
FI T _max() const { return _MAX(x, y); }
// Explicit copy and copies with conversion // Explicit copy and copies with conversion
FI XYval<T> copy() const { return *this; } FI XYval<T> copy() const { return *this; }
@ -500,6 +504,10 @@ struct XYZval {
FI operator T* () { return pos; } FI operator T* () { return pos; }
// If any element is true then it's true // If any element is true then it's true
FI operator bool() { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); } FI operator bool() { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); }
// Smallest element
FI T _min() const { return _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
// Largest element
FI T _max() const { return _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
// Explicit copy and copies with conversion // Explicit copy and copies with conversion
FI XYZval<T> copy() const { XYZval<T> o = *this; return o; } FI XYZval<T> copy() const { XYZval<T> o = *this; return o; }
@ -651,6 +659,10 @@ struct XYZEval {
FI operator T* () { return pos; } FI operator T* () { return pos; }
// If any element is true then it's true // If any element is true then it's true
FI operator bool() { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); } FI operator bool() { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); }
// Smallest element
FI T _min() const { return _MIN(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
// Largest element
FI T _max() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); }
// Explicit copy and copies with conversion // Explicit copy and copies with conversion
FI XYZEval<T> copy() const { XYZEval<T> v = *this; return v; } FI XYZEval<T> copy() const { XYZEval<T> v = *this; return v; }