aboutsummaryrefslogtreecommitdiff
path: root/src/exact_value.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-22 01:14:45 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-22 01:14:45 +0100
commit8197c02dcf964be404cd199858e84e9e8f3905e5 (patch)
tree177393f565eddb1178423d776cb275d56cfcffee /src/exact_value.cpp
parent9faf0020cc04c9c27fc7a7e7e41edce6df31376e (diff)
Default result values for procedure types; Named result values in `return` statements
Diffstat (limited to 'src/exact_value.cpp')
-rw-r--r--src/exact_value.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index ac3d6a23f..e84b5b794 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -117,6 +117,39 @@ f64 float_from_string(String string) {
i++;
}
+#if 0
+ if (len-i > 2 &&
+ str[i] == '0' &&
+ str[i+1] == 'h') {
+ i += 2;
+ u8 *text = string.text;
+ isize len = string.len;
+ if (has_prefix) {
+ text += 2;
+ len -= 2;
+ }
+
+ u64 base = 16;
+
+ u64 result = {0};
+ for (isize i = 0; i < len; i++) {
+ Rune r = cast(Rune)text[i];
+ if (r == '_') {
+ continue;
+ }
+ u64 v = bit128__digit_value(r);
+ if (v >= base) {
+ break;
+ }
+ result *= base;
+ result += v;
+ }
+
+
+ return *cast(f64 *)&result;
+ }
+#endif
+
f64 value = 0.0;
for (; i < len; i++) {
Rune r = cast(Rune)str[i];