diff options
| -rw-r--r-- | lcs.c | 17 | 
1 files changed, 9 insertions, 8 deletions
@@ -158,7 +158,7 @@ int lcs_32_rough(unsigned char *str1, unsigned char *str2) {  #endif  #ifdef USE_PRE_LCS -#define DO_SECOND_SUM +//efine DO_SECOND_SUM  #ifdef DO_SECOND_SUM  #include "arpa/inet.h" @@ -169,6 +169,7 @@ int lcs_upper_bound(const uint32_t * const str1_int, const uint32_t * const str2      const unsigned char * const str1 = (const unsigned char * const)str1_int;      const unsigned char * const str2 = (const unsigned char * const)str2_int;      int first_sum; +    int ret;  #ifdef DO_SECOND_SUM      uint32_t bo_str2_int[4];      uint32_t shifted_str2_int[4]; @@ -207,6 +208,12 @@ int lcs_upper_bound(const uint32_t * const str1_int, const uint32_t * const str2          + contains[str2_r[9]] + contains[str2_r[10]] + contains[str2_r[11]]          + contains[str2_r[12]] + contains[str2_r[13]] + contains[str2_r[14]]          + contains[str2_r[15]]; + +    // can be off up to one nibble (e.g., "1110" and "2111") +    ret = MAX(first_sum, second_sum) * 2 + 1; +#else +    // can be off up to two nibbles (e.g., "0110" and "1122") +    ret = first_sum * 2 + 2;  #endif      contains[str1[0]] = contains[str1[1]] = contains[str1[2]] @@ -216,13 +223,7 @@ int lcs_upper_bound(const uint32_t * const str1_int, const uint32_t * const str2          = contains[str1[12]] = contains[str1[13]] = contains[str1[14]]          = contains[str1[15]] = 0; -#ifdef DO_SECOND_SUM -    // can be off up to one nibble (e.g., "1110" and "2111") -    return MAX(first_sum, second_sum) * 2 + 1; -#else -    // can be off up to two nibbles (e.g., "0110" and "1122") -    return first_sum * 2 + 2; -#endif +    return ret;  }  #endif  | 
