mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Type.eql: check fn attributes before params
slightly better for cache locality
This commit is contained in:
parent
f6b479b81d
commit
b3259b47ad
21
src/type.zig
21
src/type.zig
@ -558,7 +558,7 @@ pub const Type = extern union {
|
||||
|
||||
.error_set_inferred => {
|
||||
// Inferred error sets are only equal if both are inferred
|
||||
// and they originate from the exact same function.
|
||||
// and they share the same pointer.
|
||||
const a_ies = a.castTag(.error_set_inferred).?.data;
|
||||
const b_ies = (b.castTag(.error_set_inferred) orelse return false).data;
|
||||
return a_ies == b_ies;
|
||||
@ -612,6 +612,15 @@ pub const Type = extern union {
|
||||
if (a_info.cc != b_info.cc)
|
||||
return false;
|
||||
|
||||
if (a_info.alignment != b_info.alignment)
|
||||
return false;
|
||||
|
||||
if (a_info.is_var_args != b_info.is_var_args)
|
||||
return false;
|
||||
|
||||
if (a_info.is_generic != b_info.is_generic)
|
||||
return false;
|
||||
|
||||
if (a_info.param_types.len != b_info.param_types.len)
|
||||
return false;
|
||||
|
||||
@ -622,19 +631,11 @@ pub const Type = extern union {
|
||||
|
||||
if (a_param_ty.tag() == .generic_poison) continue;
|
||||
if (b_param_ty.tag() == .generic_poison) continue;
|
||||
|
||||
if (!eql(a_param_ty, b_param_ty))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a_info.alignment != b_info.alignment)
|
||||
return false;
|
||||
|
||||
if (a_info.is_var_args != b_info.is_var_args)
|
||||
return false;
|
||||
|
||||
if (a_info.is_generic != b_info.is_generic)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user