Commit dca4c302dd

Andrew Kelley <andrew@ziglang.org>
2025-09-08 05:23:19
std.mem.indexOfSentinel: eliminate unnecessary `@ptrCast`
it was always unnecessary but now it's illegal
1 parent 2d9df0b
Changed files (1)
lib
lib/std/mem.zig
@@ -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).?;
                     }