authorgravatar for cartersnook04@gmail.comCarter Snook <cartersnook04@gmail.com> 2023-11-27 14:38:27-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-11-27 23:13:30-05:00
loga0fbc6815c7bd4ca7c5a0f9258d3f10c9a6a1d3a
treea648a5c164a66a64f42c4acfef7c1c0110188cab
parent7fbbeae617ad9c30605a78377888c284e5d9ccdc

std.zig.system: remove explicit `usize` cast

The cast seems to no longer be necessary after changes in interactions between `u64` and `usize`.

1 files changed, 3 insertions(+), 5 deletions(-)

lib/std/zig/system/NativeTargetInfo.zig+3-5
......@@ -801,11 +801,9 @@ pub fn abiAndDynamicLinkerFromFile(
801801
802802 if (dynstr) |ds| {
803803 if (rpath_offset) |rpoff| {
804 // TODO this pointer cast should not be necessary
805 const rpoff_usize = std.math.cast(usize, rpoff) orelse return error.InvalidElfFile;
806 if (rpoff_usize > ds.size) return error.InvalidElfFile;
807 const rpoff_file = ds.offset + rpoff_usize;
808 const rp_max_size = ds.size - rpoff_usize;
804 if (rpoff > ds.size) return error.InvalidElfFile;
805 const rpoff_file = ds.offset + rpoff;
806 const rp_max_size = ds.size - rpoff;
809807
810808 const strtab_len = @min(rp_max_size, strtab_buf.len);
811809 const strtab_read_len = try preadMin(file, &strtab_buf, rpoff_file, strtab_len);