mirror of
https://github.com/ziglang/zig.git
synced 2026-02-18 23:39:17 +00:00
Value: optimize isRuntimeValue
This commit is contained in:
parent
ad3e0e4eb4
commit
d69e324eae
@ -5702,6 +5702,10 @@ pub fn isNoReturn(ip: *const InternPool, ty: Index) bool {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn isRuntimeValue(ip: *const InternPool, val: Index) bool {
|
||||
return ip.items.items(.tag)[@intFromEnum(val)] == .runtime_value;
|
||||
}
|
||||
|
||||
/// This is a particularly hot function, so we operate directly on encodings
|
||||
/// rather than the more straightforward implementation of calling `indexToKey`.
|
||||
pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPoison}!std.builtin.TypeId {
|
||||
|
||||
@ -1823,7 +1823,7 @@ pub const Value = struct {
|
||||
}
|
||||
|
||||
pub fn isRuntimeValue(val: Value, mod: *Module) bool {
|
||||
return mod.intern_pool.indexToKey(val.toIntern()) == .runtime_value;
|
||||
return mod.intern_pool.isRuntimeValue(val.toIntern());
|
||||
}
|
||||
|
||||
/// Returns true if a Value is backed by a variable
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user