aboutsummaryrefslogtreecommitdiff
path: root/src/exact_value.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-11-02 00:05:51 +0000
committergingerBill <bill@gingerbill.org>2022-11-02 00:05:51 +0000
commit3b583cbac752435ec9385201f27438c96b6f8f7b (patch)
tree4c6db55b073717dc6f4178325e6052bba4871303 /src/exact_value.cpp
parent382bd87667a275f9b276886f7c1e8caac4dda5f6 (diff)
Add debug symbols for global constants of integers, bools, enums, runes, & pointers.
Variables are namespaced with `pkg::name` or `name` if built-in or the initial package for convenience.
Diffstat (limited to 'src/exact_value.cpp')
-rw-r--r--src/exact_value.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index 1572b564f..659db33b7 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -499,6 +499,13 @@ i64 exact_value_to_i64(ExactValue v) {
}
return 0;
}
+u64 exact_value_to_u64(ExactValue v) {
+ v = exact_value_to_integer(v);
+ if (v.kind == ExactValue_Integer) {
+ return big_int_to_u64(&v.value_integer);
+ }
+ return 0;
+}
f64 exact_value_to_f64(ExactValue v) {
v = exact_value_to_float(v);
if (v.kind == ExactValue_Float) {