diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-06-11 13:15:37 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-11 22:03:53 -0700 |
| commit | 63604024f47767b7b0c0deba5c9647cd6c040931 (patch) | |
| tree | 1233623946564f1cc87d34705f9fa02d1e2c8014 /src/InternPool.zig | |
| parent | 2afc689060e1d14e039f3c439d42f22ba09768a3 (diff) | |
| download | zig-63604024f47767b7b0c0deba5c9647cd6c040931.tar.gz zig-63604024f47767b7b0c0deba5c9647cd6c040931.zip | |
stage2: fix InternPool compile errors on 32-bit targets
Diffstat (limited to 'src/InternPool.zig')
| -rw-r--r-- | src/InternPool.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index a46f765ad5..9ca5a48a55 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -3824,13 +3824,13 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { assert(child == .u8_type); if (bytes.len != len) { assert(bytes.len == len_including_sentinel); - assert(bytes[len] == ip.indexToKey(sentinel).int.storage.u64); + assert(bytes[@intCast(usize, len)] == ip.indexToKey(sentinel).int.storage.u64); } }, .elems => |elems| { if (elems.len != len) { assert(elems.len == len_including_sentinel); - assert(elems[len] == sentinel); + assert(elems[@intCast(usize, len)] == sentinel); } }, .repeated_elem => |elem| { @@ -3936,7 +3936,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { if (child == .u8_type) bytes: { const string_bytes_index = ip.string_bytes.items.len; - try ip.string_bytes.ensureUnusedCapacity(gpa, len_including_sentinel + 1); + try ip.string_bytes.ensureUnusedCapacity(gpa, @intCast(usize, len_including_sentinel + 1)); try ip.extra.ensureUnusedCapacity(gpa, @typeInfo(Bytes).Struct.fields.len); switch (aggregate.storage) { .bytes => |bytes| ip.string_bytes.appendSliceAssumeCapacity(bytes), @@ -3953,7 +3953,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { .repeated_elem => |elem| switch (ip.indexToKey(elem)) { .undef => break :bytes, .int => |int| @memset( - ip.string_bytes.addManyAsSliceAssumeCapacity(len), + ip.string_bytes.addManyAsSliceAssumeCapacity(@intCast(usize, len)), @intCast(u8, int.storage.u64), ), else => unreachable, @@ -3967,7 +3967,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { const string = if (has_internal_null) @intToEnum(String, string_bytes_index) else - (try ip.getOrPutTrailingString(gpa, len_including_sentinel)).toString(); + (try ip.getOrPutTrailingString(gpa, @intCast(usize, len_including_sentinel))).toString(); ip.items.appendAssumeCapacity(.{ .tag = .bytes, .data = ip.addExtraAssumeCapacity(Bytes{ @@ -3980,7 +3980,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { try ip.extra.ensureUnusedCapacity( gpa, - @typeInfo(Tag.Aggregate).Struct.fields.len + len_including_sentinel, + @typeInfo(Tag.Aggregate).Struct.fields.len + @intCast(usize, len_including_sentinel), ); ip.items.appendAssumeCapacity(.{ .tag = .aggregate, |
