@@ -91,10 +91,7 @@ binarySearch (Fingerprint a b) fpAs fpBs =
9191 !(I# len) = Unboxed.length fpAs
9292 ind = I# (binSearchHelp (-1#) len)
9393 in
94− -- FIXME: Check second component!
95− if a == (fpAs Unboxed.! ind) && (b == (fpBs Unboxed.! ind))
96− then Just ind
97− else checkfpBs (ind + 1) (I# len)
94+ checkfpBs ind (I# len)
9895 where
9996 binSearchHelp :: Int# -> Int# -> Int#
10097 binSearchHelp l r = case l <# (r -# 1#) of
@@ -107,6 +104,6 @@ binarySearch (Fingerprint a b) fpAs fpBs =
107104
108105 checkfpBs :: Int -> Int -> Maybe Int
109106 checkfpBs i len
110− | i >= len = Nothing
111− | a == (fpAs Unboxed.! i) && b == (fpBs Unboxed.! i) = Just i
107+ | i >= len || a /= Unboxed.unsafeIndex fpAs i = Nothing
108+ | b == Unboxed.unsafeIndex fpBs i = Just i
112109 | otherwise = checkfpBs (i + 1) len