Skip to content

Commit 3c870f2

Browse files
committed
πŸ§‘β€πŸ’» Min and max for base types
1 parent 0203e32 commit 3c870f2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

β€ŽMarlin/src/core/types.hβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ struct XYval {
347347
FI operator T* () { return pos; }
348348
// If any element is true then it's true
349349
FI operator bool() { return x || y; }
350+
// Smallest element
351+
FI T _min() const { return _MIN(x, y); }
352+
// Largest element
353+
FI T _max() const { return _MAX(x, y); }
350354

351355
// Explicit copy and copies with conversion
352356
FI XYval<T> copy() const { return *this; }
@@ -500,6 +504,10 @@ struct XYZval {
500504
FI operator T* () { return pos; }
501505
// If any element is true then it's true
502506
FI operator bool() { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); }
507+
// Smallest element
508+
FI T _min() const { return _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
509+
// Largest element
510+
FI T _max() const { return _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)); }
503511

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

655667
// Explicit copy and copies with conversion
656668
FI XYZEval<T> copy() const { XYZEval<T> v = *this; return v; }

0 commit comments

Comments
Β (0)