aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-12 18:21:19 -0400
committerGitHub <noreply@github.com>2021-07-12 18:21:19 -0400
commit9b79ce1cd302a196bbb49e5fa89657bd840f4066 (patch)
treef717633b02bdd9cf1c7bc724908e8d19ef097981 /src/type.zig
parent3063f0a5ed373947badd0af056db310283c76e37 (diff)
parent28dd9d478d24190ab5c8c4b892d7dfc16c380ae0 (diff)
downloadzig-9b79ce1cd302a196bbb49e5fa89657bd840f4066.tar.gz
zig-9b79ce1cd302a196bbb49e5fa89657bd840f4066.zip
Merge pull request #9365 from ifreund/hash-map-fix
std/hash_map: fix ensureUnusedCapacity() over-allocating
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig
index 8ded2ee906..52a82c0b93 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -602,7 +602,7 @@ pub const Type = extern union {
return hasher.final();
}
- pub const HashContext = struct {
+ pub const HashContext64 = struct {
pub fn hash(self: @This(), t: Type) u64 {
_ = self;
return t.hash();
@@ -613,6 +613,17 @@ pub const Type = extern union {
}
};
+ pub const HashContext32 = struct {
+ pub fn hash(self: @This(), t: Type) u32 {
+ _ = self;
+ return @truncate(u32, t.hash());
+ }
+ pub fn eql(self: @This(), a: Type, b: Type) bool {
+ _ = self;
+ return a.eql(b);
+ }
+ };
+
pub fn copy(self: Type, allocator: *Allocator) error{OutOfMemory}!Type {
if (self.tag_if_small_enough < Tag.no_payload_count) {
return Type{ .tag_if_small_enough = self.tag_if_small_enough };