diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-20 16:09:24 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-20 16:09:24 +0200 |
| commit | 6b131c925dee7a5f97516edd581e051e08bb52d8 (patch) | |
| tree | 680ae83121442f777e03aa0a0d1299cc364b95dd /boot/evaluator.cc | |
| parent | cbbe1593bb0893654bd71e611ca610df03bac768 (diff) | |
| download | elna-6b131c925dee7a5f97516edd581e051e08bb52d8.tar.gz | |
Implement min and max for booleans and floats
Diffstat (limited to 'boot/evaluator.cc')
| -rw-r--r-- | boot/evaluator.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/boot/evaluator.cc b/boot/evaluator.cc index b7edd3a..7eb612b 100644 --- a/boot/evaluator.cc +++ b/boot/evaluator.cc @@ -534,6 +534,14 @@ namespace elna::boot { return constant_value{ static_cast<unsigned char>(0) }; } + if (is_primitive_type(resolved, "Bool")) + { + return constant_value{ false }; + } + if (is_primitive_type(resolved, "Float")) + { + return constant_value{ -std::numeric_limits<double>::max() }; + } if (auto enumeration = resolved.get<enumeration_type>()) { return constant_value{ 1 }; @@ -555,6 +563,14 @@ namespace elna::boot { return constant_value{ std::numeric_limits<unsigned char>::max() }; } + if (is_primitive_type(resolved, "Bool")) + { + return constant_value{ true }; + } + if (is_primitive_type(resolved, "Float")) + { + return constant_value{ std::numeric_limits<double>::max() }; + } if (auto enumeration = resolved.get<enumeration_type>()) { return constant_value{ static_cast<std::int32_t>(enumeration->members.size()) }; |
