diff options
author | Eric Anderson <ejona86@gmail.com> | 2010-12-26 10:18:22 -0600 |
---|---|---|
committer | Eric Anderson <ejona86@gmail.com> | 2010-12-26 10:18:22 -0600 |
commit | e4c49643c47f4d69282a8d1ad2f05619bd4d86b9 (patch) | |
tree | 901277feac21136f6c40d4f2886319b9e86dba83 | |
parent | ff2d93e1b4ea34ddaa42be5e9c987861849e4b2b (diff) | |
download | md5game-e4c49643c47f4d69282a8d1ad2f05619bd4d86b9.tar.gz md5game-e4c49643c47f4d69282a8d1ad2f05619bd4d86b9.zip |
Only do second sum if it can make a difference
-rw-r--r-- | lcs.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; |