std.zig.system: remove explicit usize cast

The cast seems to no longer be necessary after changes in interactions
between `u64` and `usize`.
This commit is contained in:
Carter Snook 2023-11-27 14:38:27 -06:00 committed by Andrew Kelley
parent 7fbbeae617
commit a0fbc6815c

View File

@ -801,11 +801,9 @@ pub fn abiAndDynamicLinkerFromFile(
if (dynstr) |ds| {
if (rpath_offset) |rpoff| {
// TODO this pointer cast should not be necessary
const rpoff_usize = std.math.cast(usize, rpoff) orelse return error.InvalidElfFile;
if (rpoff_usize > ds.size) return error.InvalidElfFile;
const rpoff_file = ds.offset + rpoff_usize;
const rp_max_size = ds.size - rpoff_usize;
if (rpoff > ds.size) return error.InvalidElfFile;
const rpoff_file = ds.offset + rpoff;
const rp_max_size = ds.size - rpoff;
const strtab_len = @min(rp_max_size, strtab_buf.len);
const strtab_read_len = try preadMin(file, &strtab_buf, rpoff_file, strtab_len);