From 564b1da2144a94fd3cf4c66614968d8b669bc26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Mon, 1 Jan 2024 16:25:17 +0100 Subject: [PATCH] Change `<` to `<=` in `indexOfSentinel` SIMD path --- lib/std/mem.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/mem.zig b/lib/std/mem.zig index b3224243c6..2ed8b57acf 100644 --- a/lib/std/mem.zig +++ b/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;