mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-09 15:52:27 +03:00
noodle: behave like our other literal matchers
Noodle now supports supplementary masks.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -38,8 +38,8 @@ static really_inline m128 getCaseMask(void) {
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanSingleShort(const u8 *buf, size_t len, const u8 *key,
|
||||
bool noCase, m128 caseMask, m128 mask1,
|
||||
hwlm_error_t scanSingleShort(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, bool noCase, m128 caseMask, m128 mask1,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
const u8 *d = buf + start;
|
||||
@@ -67,10 +67,11 @@ hwlm_error_t scanSingleShort(const u8 *buf, size_t len, const u8 *key,
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanSingleUnaligned(const u8 *buf, size_t len, size_t offset,
|
||||
const u8 *key, bool noCase, m128 caseMask,
|
||||
m128 mask1, const struct cb_info *cbi,
|
||||
size_t start, size_t end) {
|
||||
hwlm_error_t scanSingleUnaligned(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, size_t offset, bool noCase,
|
||||
m128 caseMask, m128 mask1,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
const u8 *d = buf + offset;
|
||||
DEBUG_PRINTF("start %zu end %zu offset %zu\n", start, end, offset);
|
||||
const size_t l = end - start;
|
||||
@@ -96,11 +97,10 @@ hwlm_error_t scanSingleUnaligned(const u8 *buf, size_t len, size_t offset,
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanDoubleShort(const u8 *buf, size_t len, const u8 *key,
|
||||
size_t keyLen, size_t keyOffset, bool noCase,
|
||||
m128 caseMask, m128 mask1, m128 mask2,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
hwlm_error_t scanDoubleShort(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, bool noCase, m128 caseMask, m128 mask1,
|
||||
m128 mask2, const struct cb_info *cbi,
|
||||
size_t start, size_t end) {
|
||||
const u8 *d = buf + start;
|
||||
size_t l = end - start;
|
||||
if (!l) {
|
||||
@@ -128,11 +128,11 @@ hwlm_error_t scanDoubleShort(const u8 *buf, size_t len, const u8 *key,
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanDoubleUnaligned(const u8 *buf, size_t len, size_t offset,
|
||||
const u8 *key, size_t keyLen, size_t keyOffset,
|
||||
bool noCase, m128 caseMask, m128 mask1,
|
||||
m128 mask2, const struct cb_info *cbi,
|
||||
size_t start, size_t end) {
|
||||
hwlm_error_t scanDoubleUnaligned(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, size_t offset, bool noCase,
|
||||
m128 caseMask, m128 mask1, m128 mask2,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
const u8 *d = buf + offset;
|
||||
DEBUG_PRINTF("start %zu end %zu offset %zu\n", start, end, offset);
|
||||
size_t l = end - start;
|
||||
@@ -158,8 +158,8 @@ hwlm_error_t scanDoubleUnaligned(const u8 *buf, size_t len, size_t offset,
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanSingleFast(const u8 *buf, size_t len, const u8 *key,
|
||||
bool noCase, m128 caseMask, m128 mask1,
|
||||
hwlm_error_t scanSingleFast(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, bool noCase, m128 caseMask, m128 mask1,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
const u8 *d = buf + start, *e = buf + end;
|
||||
@@ -179,10 +179,9 @@ hwlm_error_t scanSingleFast(const u8 *buf, size_t len, const u8 *key,
|
||||
}
|
||||
|
||||
static really_inline
|
||||
hwlm_error_t scanDoubleFast(const u8 *buf, size_t len, const u8 *key,
|
||||
size_t keyLen, size_t keyOffset, bool noCase,
|
||||
m128 caseMask, m128 mask1, m128 mask2,
|
||||
const struct cb_info *cbi, size_t start,
|
||||
hwlm_error_t scanDoubleFast(const struct noodTable *n, const u8 *buf,
|
||||
size_t len, bool noCase, m128 caseMask, m128 mask1,
|
||||
m128 mask2, const struct cb_info *cbi, size_t start,
|
||||
size_t end) {
|
||||
const u8 *d = buf + start, *e = buf + end;
|
||||
assert(d < e);
|
||||
|
Reference in New Issue
Block a user