Create Specialized SCMemcmpNZ() when the length can't be zero.

pull/1295/head
Ken Steele 11 years ago committed by Victor Julien
parent 7835070385
commit 900def5caf

@ -365,14 +365,12 @@ static inline int SCMemcmpLowercase(const void *s1, const void *s2, size_t len)
#include <ctype.h>
static inline int SCMemcmp(const void *s1, const void *s2, size_t len)
/* Compare to non-zero sequence of bytes. */
static inline int SCMemcmpNZ(const void *s1, const void *s2, size_t len)
{
uint64_t b1, w1, aligned1;
uint64_t b2, w2, aligned2;
if (len == 0)
return 0;
/* Load aligned words containing the beginning of each string.
* These loads don't trigger unaligned events.
*/
@ -411,6 +409,13 @@ static inline int SCMemcmp(const void *s1, const void *s2, size_t len)
return 0;
}
/* Compare two sequences of bytes. */
static inline int SCMemcmp(const void *s1, const void *s2, size_t len)
{
if (len == 0)
return 0;
return SCMemcmpNZ(s1, s2, len);
}
/** \brief Convert 8 characters to lower case using SIMD.
* \param Word containing the 8 bytes.
* \return Word containing 8-bytes each converted to lowercase.

@ -1494,7 +1494,7 @@ int CheckMatch(SCACTileSearchCtx *ctx, PatternMatcherQueue *pmq,
/* Double check case-sensitve match now. */
if (patterns[k] & 0xFFFF0000) {
uint16_t patlen = pattern_list[pindex].patlen;
if (SCMemcmp(pattern_list[pindex].cs, buf_offset - patlen, patlen) != 0) {
if (SCMemcmpNZ(pattern_list[pindex].cs, buf_offset - patlen, patlen) != 0) {
/* Case-sensitive match failed. */
continue;
}

Loading…
Cancel
Save