Browse Source

🧑‍💻 Min and max for base types

Scott Lahteine 2 years ago
parent
commit
77227f66c2
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      Marlin/src/core/types.h

+ 12
- 0
Marlin/src/core/types.h View File

347
   FI operator T* ()                                     { return pos; }
347
   FI operator T* ()                                     { return pos; }
348
   // If any element is true then it's true
348
   // If any element is true then it's true
349
   FI operator bool()                                    { return x || y; }
349
   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); }
350
 
354
 
351
   // Explicit copy and copies with conversion
355
   // Explicit copy and copies with conversion
352
   FI XYval<T>           copy()                    const { return *this; }
356
   FI XYval<T>           copy()                    const { return *this; }
500
   FI operator T* ()                                    { return pos; }
504
   FI operator T* ()                                    { return pos; }
501
   // If any element is true then it's true
505
   // If any element is true then it's true
502
   FI operator bool()                                   { return NUM_AXIS_GANG(x, || y, || z, || i, || j, || k, || u, || v, || w); }
506
   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)); }
503
 
511
 
504
   // Explicit copy and copies with conversion
512
   // Explicit copy and copies with conversion
505
   FI XYZval<T>          copy()                   const { XYZval<T> o = *this; return o; }
513
   FI XYZval<T>          copy()                   const { XYZval<T> o = *this; return o; }
651
   FI operator T* ()                                      { return pos; }
659
   FI operator T* ()                                      { return pos; }
652
   // If any element is true then it's true
660
   // If any element is true then it's true
653
   FI operator bool()                                     { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); }
661
   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)); }
654
 
666
 
655
   // Explicit copy and copies with conversion
667
   // Explicit copy and copies with conversion
656
   FI XYZEval<T>          copy()  const { XYZEval<T> v = *this; return v; }
668
   FI XYZEval<T>          copy()  const { XYZEval<T> v = *this; return v; }

Loading…
Cancel
Save