aboutsummaryrefslogtreecommitdiff
path: root/boot/evaluator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'boot/evaluator.cc')
-rw-r--r--boot/evaluator.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/boot/evaluator.cc b/boot/evaluator.cc
index 6cf287c..67fc42a 100644
--- a/boot/evaluator.cc
+++ b/boot/evaluator.cc
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see
#include <cmath>
#include <cstddef>
-#include <limits>
#include <ranges>
namespace elna::boot
@@ -1048,15 +1047,18 @@ namespace elna::boot
}
if (is_primitive_type(resolved, "Single"))
{
- return constant_value{ float_literal::from(std::numeric_limits<float>::min()) };
+ return constant_value{ float_literal::from(this->target.single_properties.min) };
}
if (is_primitive_type(resolved, "Double"))
{
- return constant_value{ float_literal::from(std::numeric_limits<double>::min()) };
+ return constant_value{ float_literal::from(this->target.double_properties.min) };
}
if (const auto enumeration = resolved.get<enumeration_type>())
{
- return constant_value{ integer_literal::from<std::size_t>(1) };
+ return constant_value{
+ integer_literal::from<std::size_t>(
+ this->target.word_properties.front().size, 1U).value()
+ };
}
}
else if (subject.name.name() == "max")
@@ -1085,7 +1087,8 @@ namespace elna::boot
}
if (is_primitive_type(resolved, "Char"))
{
- return constant_value{ std::numeric_limits<std::uint32_t>::max() };
+ constexpr std::uint32_t max_unicode_codepoint = 0x10FFFF;
+ return constant_value{ max_unicode_codepoint };
}
if (is_primitive_type(resolved, "Bool"))
{
@@ -1093,15 +1096,19 @@ namespace elna::boot
}
if (is_primitive_type(resolved, "Single"))
{
- return constant_value{ float_literal::from(std::numeric_limits<float>::max()) };
+ return constant_value{ float_literal::from(this->target.single_properties.max) };
}
if (is_primitive_type(resolved, "Double"))
{
- return constant_value{ float_literal::from(std::numeric_limits<double>::max()) };
+ return constant_value{ float_literal::from(this->target.double_properties.max) };
}
if (const auto enumeration = resolved.get<enumeration_type>())
{
- return constant_value{ integer_literal::from(enumeration->members.size()) };
+ return constant_value{
+ integer_literal::from<std::size_t>(
+ this->target.word_properties.front().size,
+ enumeration->members.size()).value()
+ };
}
}
else if (subject.name.name() == "offset")