Merge remote-tracking branch 'origin/dict-more' into zig-list

This commit is contained in:
Folkert 2021-02-17 16:19:36 +01:00
commit 3093fe9e18
11 changed files with 331 additions and 96 deletions

View file

@ -276,6 +276,10 @@ pub const RocDict = extern struct {
}
fn setKey(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
if (key_width == 0) {
return;
}
const offset = blk: {
if (alignment.keyFirst()) {
break :blk (index * key_width);
@ -305,6 +309,10 @@ pub const RocDict = extern struct {
}
fn setValue(self: *RocDict, index: usize, alignment: Alignment, key_width: usize, value_width: usize, data: Opaque) void {
if (value_width == 0) {
return;
}
const offset = blk: {
if (alignment.keyFirst()) {
break :blk (self.capacity() * key_width) + (index * value_width);