zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ee09eb7f5461aa9e2374a6adbfbf130bfc0ebf21 (tree)
parent 9d94c2ccd0341961ffb18ec7eb40ef6099d71794
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Thu,  5 Jan 2017 03:40:04 -0500

fix hash map implementation

standard library passes all tests now

Diffstat:
Mstd/hash_map.zig | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

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