Update Comparison.h
This commit is contained in:
@@ -10,28 +10,23 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <concepts>
|
|
||||||
|
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
namespace facebook::yoga {
|
namespace facebook::yoga {
|
||||||
|
|
||||||
constexpr bool isUndefined(std::floating_point auto value) {
|
constexpr bool isUndefined(auto value) {
|
||||||
return value != value;
|
return value != value;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr float maxOrDefined(
|
constexpr float maxOrDefined(auto a, auto b) {
|
||||||
std::floating_point auto a,
|
|
||||||
std::floating_point auto b) {
|
|
||||||
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
||||||
return std::max(a, b);
|
return std::max(a, b);
|
||||||
}
|
}
|
||||||
return yoga::isUndefined(a) ? b : a;
|
return yoga::isUndefined(a) ? b : a;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr float minOrDefined(
|
constexpr float minOrDefined(auto a, auto b) {
|
||||||
std::floating_point auto a,
|
|
||||||
std::floating_point auto b) {
|
|
||||||
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
||||||
return std::min(a, b);
|
return std::min(a, b);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user