fix ahocorasick on big-endian machines (#1401)

This commit is contained in:
Vinicius Silva Nogueira
2022-01-13 17:35:06 +01:00
committed by GitHub
parent d59fefd06e
commit dc60cd09c4
+5 -1
View File
@@ -849,7 +849,11 @@ xmemchr(char *s, char i,int n)
mask = c * DUPC;
while (n >= LBLOCKSIZE) {
unsigned long int nc = DETECTNULL((*(unsigned long int *)s) ^ mask);
#if __SIZEOF_LONG__ == 4
unsigned long int nc = DETECTNULL(le32toh(*(unsigned long int *)s) ^ mask);
#else
unsigned long int nc = DETECTNULL(le64toh(*(unsigned long int *)s) ^ mask);
#endif
if(nc)
return s + (bsf(nc) >> 3);
s += LBLOCKSIZE;