std.mem.indexOfSentinel: eliminate unnecessary @ptrCast

it was always unnecessary but now it's illegal
This commit is contained in:
Andrew Kelley 2025-09-07 20:23:19 -07:00
parent 2d9df0bb1a
commit dca4c302dd

View File

@ -1156,10 +1156,10 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
}
}
assert(std.mem.isAligned(@intFromPtr(&p[i]), block_size));
std.debug.assertAligned(&p[i], .fromByteUnits(block_size));
while (true) {
const block: *const Block = @ptrCast(@alignCast(p[i..][0..block_len]));
const matches = block.* == mask;
const block: Block = p[i..][0..block_len].*;
const matches = block == mask;
if (@reduce(.Or, matches)) {
return i + std.simd.firstTrue(matches).?;
}