zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit dca4c302dd323f093c53b354ad64d504ed7a2dea (tree)
parent 2d9df0bb1a79267b4bc6b91125d4d2eebc31bc26
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun,  7 Sep 2025 20:23:19 -0700

std.mem.indexOfSentinel: eliminate unnecessary `@ptrCast`

it was always unnecessary but now it's illegal

Diffstat:
Mlib/std/mem.zig | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/std/mem.zig b/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).?; }