Arduino Filters master
Filter library for Arduino
MinMaxFix.hpp
Go to the documentation of this file.
1#pragma once
2
4AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
5
6#include <AH/Math/FixArduinoMacros.hpp>
7
9
11
14template <class T, class U>
15constexpr auto min(const T &a, const U &b) -> decltype(b < a ? b : a) {
16 return b < a ? b : a;
17}
18
21template <class T, class U>
22constexpr auto max(const T &a, const U &b) -> decltype(a < b ? b : a) {
23 return a < b ? b : a;
24}
25
27
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
constexpr auto min(const T &a, const U &b) -> decltype(b< a ? b :a)
Return the smaller of two numbers/objects.
Definition: MinMaxFix.hpp:15
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.
Definition: MinMaxFix.hpp:22