authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-05 03:40:04-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-05 03:40:12-05:00
logee09eb7f5461aa9e2374a6adbfbf130bfc0ebf21
treec73e6d66aa04a59360aaa760f5fde067d1b75555
parent9d94c2ccd0341961ffb18ec7eb40ef6099d71794

fix hash map implementation

standard library passes all tests now

1 files changed, 3 insertions(+), 0 deletions(-)

std/hash_map.zig+3
...@@ -76,6 +76,9 @@ pub fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32,...@@ -76,6 +76,9 @@ pub fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32,
76 }76 }
7777
78 pub fn put(hm: &Self, key: K, value: V) -> %void {78 pub fn put(hm: &Self, key: K, value: V) -> %void {
79 if (hm.entries.len == 0) {
80 %return hm.initCapacity(16);
81 }
79 hm.incrementModificationCount();82 hm.incrementModificationCount();
8083
81 // if we get too full (60%), double the capacity84 // if we get too full (60%), double the capacity