Browse code

altstr: fixed optimization error with fixed len alternates altstr: consistent conditional applied to byte alternates

Kevin Lin authored on 2015/05/23 05:31:24
Showing 1 changed files
... ...
@@ -949,11 +949,11 @@ inline static int ac_findmatch_special(const unsigned char *buffer, uint32_t off
949 949
     switch(special->type) {
950 950
     case AC_SPECIAL_ALT_CHAR: /* single-byte */
951 951
         for (j = 0; j < special->num; j++) {
952
-            cmp = (special->alt).byte[j] - b;
952
+            cmp = b - (special->alt).byte[j];
953 953
             if (cmp == 0) {
954 954
                 match = !special->negative;
955 955
                 break;
956
-            } else if (cmp > 0)
956
+            } else if (cmp < 0)
957 957
                 break;
958 958
         }
959 959
         break;
... ...
@@ -968,7 +968,7 @@ inline static int ac_findmatch_special(const unsigned char *buffer, uint32_t off
968 968
             if (cmp == 0) {
969 969
                 match = (!special->negative) * special->len;
970 970
                 break;
971
-            } else if (cmp > 0)
971
+            } else if (cmp < 0)
972 972
                 break;
973 973
         }
974 974
         break;