diff options
author | Vinicius Silva Nogueira <vinicius_snogueira@hotmail.com> | 2022-01-13 13:35:06 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 17:35:06 +0100 |
commit | dc60cd09c49f52d2eba6c169f973f757695e4f5a (patch) | |
tree | e070110062066f2e60eb1062dc69fb376d1a2170 | |
parent | d59fefd06eb0334fe233a6c2339c50b180ae1f0b (diff) |
fix ahocorasick on big-endian machines (#1401)
-rw-r--r-- | src/lib/third_party/src/ahocorasick.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/third_party/src/ahocorasick.c b/src/lib/third_party/src/ahocorasick.c index ba526056f..39b08443b 100644 --- a/src/lib/third_party/src/ahocorasick.c +++ b/src/lib/third_party/src/ahocorasick.c @@ -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; |