branch: externals/hotfuzz
commit a517bfa7ebc0a4900d27fa9a9452bde60cbb9c1d
Author: Axel Forsman <[email protected]>
Commit: Axel Forsman <[email protected]>

    Fix C/D boundary conditions
    
    Since we do not allow insertions of characters in the needle string,
    the top row (except for the top left cell!) should have really high
    costs.
---
 hotfuzz.el | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hotfuzz.el b/hotfuzz.el
index 775d5136ca..6ca639d98f 100644
--- a/hotfuzz.el
+++ b/hotfuzz.el
@@ -38,8 +38,7 @@ j - the column"
          (c hotfuzz--c) (d hotfuzz--d))
     (if (> m hotfuzz-max-match-len)
         most-positive-fixnum
-      (cl-loop for j below n do
-               (aset d j (+ (aset c j (+ hotfuzz-g (* hotfuzz-h (1+ j)))) 
hotfuzz-g)))
+      (cl-loop for j below n do (aset d j (aset c j 10000)))
       (cl-loop for i below m do (hotfuzz--match-row haystack needle i c d c d)
                finally return (if (zerop n)
                                   (+ hotfuzz-g (* hotfuzz-h m))
@@ -67,8 +66,7 @@ j - the column"
          (c hotfuzz--c) (d hotfuzz--d))
     (if (> m hotfuzz-max-match-len)
         haystack ; Bail out if too long candidate
-      (cl-loop for j below n do
-               (aset d j (+ (aset c j (+ hotfuzz-g (* hotfuzz-h (1+ j)))) 
hotfuzz-g)))
+      (cl-loop for j below n do (aset d j (aset c j 10000)))
       (let ((rows (cl-loop
                    with nc = nil and nd = nil
                    for i below m and pc = c then nc and pd = d then nd with 
res = nil do

Reply via email to