diff --git a/src/js/strie.js b/src/js/strie.js index b9b94df22..6a3096fa3 100644 --- a/src/js/strie.js +++ b/src/js/strie.js @@ -658,7 +658,7 @@ const roundToPageSize = v => (v + PAGE_SIZE-1) & ~(PAGE_SIZE-1); i += 1; } haystackLeft += 1; - if ( haystackLeft === haystackEnd ) { break; } + if ( haystackLeft > haystackEnd ) { break; } } return -1; } diff --git a/src/js/wasm/biditrie.wasm b/src/js/wasm/biditrie.wasm index e1de9312c..5bfc6b7d0 100644 Binary files a/src/js/wasm/biditrie.wasm and b/src/js/wasm/biditrie.wasm differ diff --git a/src/js/wasm/biditrie.wat b/src/js/wasm/biditrie.wat index 3cd76a618..b98d87951 100644 --- a/src/js/wasm/biditrie.wat +++ b/src/js/wasm/biditrie.wat @@ -606,9 +606,9 @@ i32.const 1 i32.add tee_local $haystackLeft - ;; if ( haystackLeft === haystackEnd ) { break; } + ;; if ( haystackLeft > haystackEnd ) { break; } get_local $haystackEnd - i32.eq + i32.gt_u br_if $fail br $mainLoop ;; }