Change < to <= in indexOfSentinel SIMD path

This commit is contained in:
Carl Åstholm 2024-01-01 16:25:17 +01:00
parent 59ac0d1eed
commit 564b1da214

View File

@ -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;