Default result values for procedure types; Named result values in return statements

This commit is contained in:
Ginger Bill
2017-06-22 01:14:45 +01:00
parent 9faf0020cc
commit 8197c02dcf
10 changed files with 484 additions and 194 deletions
+33
View File
@@ -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];