mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
figured out how to serialize nested structures
This commit is contained in:
parent
fc01a0ee44
commit
8e5b0daa94
4 changed files with 136 additions and 45 deletions
|
@ -2541,14 +2541,14 @@ pub fn strCloneTo(
|
|||
const slice = string.asSlice();
|
||||
|
||||
var relative = string;
|
||||
relative.str_bytes = @intToPtr(?[*]u8, offset + WIDTH); // i.e. just after the string struct
|
||||
relative.str_bytes = @intToPtr(?[*]u8, extra_offset); // i.e. just after the string struct
|
||||
|
||||
// write the string struct
|
||||
const array = relative.asArray();
|
||||
@memcpy(ptr + offset, &array, WIDTH);
|
||||
|
||||
// write the string bytes just after the struct
|
||||
@memcpy(ptr + extra_offset + WIDTH, slice.ptr, slice.len);
|
||||
@memcpy(ptr + extra_offset, slice.ptr, slice.len);
|
||||
|
||||
return extra_offset + slice.len;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue