aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig
index 40ce977711..b759a4bc34 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -3005,6 +3005,13 @@ pub const Type = extern union {
return ty.arrayLen() + @boolToInt(ty.sentinel() != null);
}
+ pub fn vectorLen(ty: Type) u32 {
+ return switch (ty.tag()) {
+ .vector => @intCast(u32, ty.castTag(.vector).?.data.len),
+ else => unreachable,
+ };
+ }
+
/// Asserts the type is an array, pointer or vector.
pub fn sentinel(self: Type) ?Value {
return switch (self.tag()) {