aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-12 12:40:32 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-12 12:40:32 -0700
commit28dd9d478d24190ab5c8c4b892d7dfc16c380ae0 (patch)
treef717633b02bdd9cf1c7bc724908e8d19ef097981 /src/type.zig
parent03156e589939993bba339162d27d24fd511601c6 (diff)
downloadzig-28dd9d478d24190ab5c8c4b892d7dfc16c380ae0.tar.gz
zig-28dd9d478d24190ab5c8c4b892d7dfc16c380ae0.zip
C backend: TypedefMap is now ArrayHashMap
The C backend depends on insertion order into this map so that type definitions will be declared before they are used.
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 };