Commit 564b1da214

Carl Åstholm <carl@astholm.se>
2024-01-01 16:25:17
Change `<` to `<=` in `indexOfSentinel` SIMD path
1 parent 59ac0d1
Changed files (1)
lib
lib/std/mem.zig
@@ -975,7 +975,7 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
                 // First block may be unaligned
                 const start_addr = @intFromPtr(&p[i]);
                 const offset_in_page = start_addr & (std.mem.page_size - 1);
-                if (offset_in_page < std.mem.page_size - @sizeOf(Block)) {
+                if (offset_in_page <= std.mem.page_size - @sizeOf(Block)) {
                     // Will not read past the end of a page, full block.
                     const block: Block = p[i..][0..block_len].*;
                     const matches = block == mask;