From a0fbc6815c7bd4ca7c5a0f9258d3f10c9a6a1d3a Mon Sep 17 00:00:00 2001 From: Carter Snook Date: Mon, 27 Nov 2023 14:38:27 -0600 Subject: [PATCH] std.zig.system: remove explicit `usize` cast The cast seems to no longer be necessary after changes in interactions between `u64` and `usize`. --- lib/std/zig/system/NativeTargetInfo.zig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig index 47226eff89..5089b74c68 100644 --- a/lib/std/zig/system/NativeTargetInfo.zig +++ b/lib/std/zig/system/NativeTargetInfo.zig @@ -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);