package core.conv
+str_to_i64 :: (s: str) -> i64 {
+ use package core
+
+ value: i64 = 0;
+ mul := 1;
+
+ if s[0] == #char "-" {
+ mul = -1;
+ s = string.advance(s, 1);
+ }
+
+ for c: s do switch c {
+ case #char "0" .. #char "9" {
+ value *= 10;
+ value += ~~(c - #char "0");
+ }
+
+ case #default do break break;
+ }
+
+ return value * ~~mul;
+}
+
i64_to_str :: (n: i64, base: u64, buf: [] u8, min_length := 0) -> str {
is_neg := false;
if n < 0 && base == 10 {
package core.string
+use package core
+
make :: (s: cstr) -> str {
len := length(s);
}
}
+advance :: proc {
+ // Inplace version
+ (s: ^str, chars := 1) {
+ chars = math.min(chars, s.count);
+
+ s.data += chars;
+ s.count -= chars;
+ },
+
+ // Out of place version
+ (s: str, chars := 1) -> str {
+ chars = math.min(chars, s.count);
+ out := s;
+
+ out.data += chars;
+ out.count -= chars;
+
+ return out;
+ }
+}
read_u32 :: (s: ^str, out: ^u32) {
n := 0;
emit_expression(mod, &code, assign->right);
u64 localidx = bh_imap_get(&mod->local_map, (u64) lval);
- WIL(WI_LOCAL_SET, localidx);
+
+ if (lval->kind == Ast_Kind_Param && type_is_structlike_strict(lval->type)) {
+ u32 mem_count = type_structlike_mem_count(lval->type);
+ fori (i, 0, mem_count) WIL(WI_LOCAL_SET, localidx + i);
+
+ } else {
+ WIL(WI_LOCAL_SET, localidx);
+ }
*pcode = code;
return;