summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anderson <ejona86@gmail.com>2010-12-26 10:18:22 -0600
committerEric Anderson <ejona86@gmail.com>2010-12-26 10:18:22 -0600
commite4c49643c47f4d69282a8d1ad2f05619bd4d86b9 (patch)
tree901277feac21136f6c40d4f2886319b9e86dba83
parentff2d93e1b4ea34ddaa42be5e9c987861849e4b2b (diff)
downloadmd5game-e4c49643c47f4d69282a8d1ad2f05619bd4d86b9.tar.gz
md5game-e4c49643c47f4d69282a8d1ad2f05619bd4d86b9.zip
Only do second sum if it can make a difference
-rw-r--r--lcs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lcs.c b/lcs.c
index b971c79..f3a6203 100644
--- a/lcs.c
+++ b/lcs.c
@@ -158,7 +158,7 @@ int lcs_32_rough(unsigned char *str1, unsigned char *str2) {
#endif
#ifdef USE_PRE_LCS
-//efine DO_SECOND_SUM
+#define DO_SECOND_SUM
#ifdef DO_SECOND_SUM
#include "arpa/inet.h"
@@ -188,7 +188,9 @@ int lcs_upper_bound(const uint32_t * const str1_int, const uint32_t * const str2
// can be off up to two nibbles (e.g., "0110" and "1122")
ret = first_sum * 2 + 2;
#ifdef DO_SECOND_SUM
- if (ret >= MSF) {
+ // We can only increase our accuracy by 1, so do second_sum only if we can
+ // turn a false-positive into a negative
+ if (ret == MSF) {
uint32_t bo_str2_int[4];
uint32_t shifted_str2_int[4];
const unsigned char * const str2_r = (const unsigned char * const)shifted_str2_int;