| ... | ... | @@ -496,14 +496,14 @@ pub const Type = enum(u32) { |
| 496 | 496 | }; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | | pub fn aggregateLen(self: Type, builder: *const Builder) u64 { |
| 499 | pub fn aggregateLen(self: Type, builder: *const Builder) usize { |
| 500 | 500 | const item = builder.type_items.items[@intFromEnum(self)]; |
| 501 | 501 | return switch (item.tag) { |
| 502 | 502 | .vector, |
| 503 | 503 | .scalable_vector, |
| 504 | 504 | .small_array, |
| 505 | 505 | => builder.typeExtraData(Type.Vector, item.data).len, |
| 506 | | .array => builder.typeExtraData(Type.Array, item.data).length(), |
| 506 | .array => @intCast(builder.typeExtraData(Type.Array, item.data).length()), |
| 507 | 507 | .structure, |
| 508 | 508 | .packed_structure, |
| 509 | 509 | => builder.typeExtraData(Type.Structure, item.data).fields_len, |
| ... | ... | @@ -5158,7 +5158,7 @@ pub fn stringIfExists(self: *const Builder, bytes: []const u8) ?String { |
| 5158 | 5158 | |
| 5159 | 5159 | pub fn fmt(self: *Builder, comptime fmt_str: []const u8, fmt_args: anytype) Allocator.Error!String { |
| 5160 | 5160 | try self.string_map.ensureUnusedCapacity(self.gpa, 1); |
| 5161 | | try self.string_bytes.ensureUnusedCapacity(self.gpa, std.fmt.count(fmt_str ++ .{0}, fmt_args)); |
| 5161 | try self.string_bytes.ensureUnusedCapacity(self.gpa, @intCast(std.fmt.count(fmt_str ++ .{0}, fmt_args))); |
| 5162 | 5162 | try self.string_indices.ensureUnusedCapacity(self.gpa, 1); |
| 5163 | 5163 | return self.fmtAssumeCapacity(fmt_str, fmt_args); |
| 5164 | 5164 | } |
| ... | ... | @@ -5230,8 +5230,10 @@ pub fn structType( |
| 5230 | 5230 | |
| 5231 | 5231 | pub fn opaqueType(self: *Builder, name: String) Allocator.Error!Type { |
| 5232 | 5232 | try self.string_map.ensureUnusedCapacity(self.gpa, 1); |
| 5233 | | if (name.toSlice(self)) |id| try self.string_bytes.ensureUnusedCapacity(self.gpa, id.len + |
| 5234 | | comptime std.fmt.count("{d}" ++ .{0}, .{std.math.maxInt(u32)})); |
| 5233 | if (name.toSlice(self)) |id| { |
| 5234 | const count: usize = comptime std.fmt.count("{d}" ++ .{0}, .{std.math.maxInt(u32)}); |
| 5235 | try self.string_bytes.ensureUnusedCapacity(self.gpa, id.len + count); |
| 5236 | } |
| 5235 | 5237 | try self.string_indices.ensureUnusedCapacity(self.gpa, 1); |
| 5236 | 5238 | try self.types.ensureUnusedCapacity(self.gpa, 1); |
| 5237 | 5239 | try self.next_unique_type_id.ensureUnusedCapacity(self.gpa, 1); |
| ... | ... | @@ -6236,8 +6238,10 @@ fn isValidIdentifier(id: []const u8) bool { |
| 6236 | 6238 | fn ensureUnusedGlobalCapacity(self: *Builder, name: String) Allocator.Error!void { |
| 6237 | 6239 | if (self.useLibLlvm()) try self.llvm.globals.ensureUnusedCapacity(self.gpa, 1); |
| 6238 | 6240 | try self.string_map.ensureUnusedCapacity(self.gpa, 1); |
| 6239 | | if (name.toSlice(self)) |id| try self.string_bytes.ensureUnusedCapacity(self.gpa, id.len + |
| 6240 | | comptime std.fmt.count("{d}" ++ .{0}, .{std.math.maxInt(u32)})); |
| 6241 | if (name.toSlice(self)) |id| { |
| 6242 | const count: usize = comptime std.fmt.count("{d}" ++ .{0}, .{std.math.maxInt(u32)}); |
| 6243 | try self.string_bytes.ensureUnusedCapacity(self.gpa, id.len + count); |
| 6244 | } |
| 6241 | 6245 | try self.string_indices.ensureUnusedCapacity(self.gpa, 1); |
| 6242 | 6246 | try self.globals.ensureUnusedCapacity(self.gpa, 1); |
| 6243 | 6247 | try self.next_unique_global_id.ensureUnusedCapacity(self.gpa, 1); |