From: Matthew Barr Date: Tue, 30 May 2017 06:26:13 +0000 (+1000) Subject: noodle: we don't need memcpy X-Git-Tag: v4.6.0^2~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=293f9fcc495a9ba139c58e852f0d7e7bf2647f3c;p=thirdparty%2Fvectorscan.git noodle: we don't need memcpy --- diff --git a/src/hwlm/noodle_engine.c b/src/hwlm/noodle_engine.c index 0370ef31..4897eb09 100644 --- a/src/hwlm/noodle_engine.c +++ b/src/hwlm/noodle_engine.c @@ -39,6 +39,7 @@ #include "util/intrinsics.h" #include "util/join.h" #include "util/masked_move.h" +#include "util/partial_store.h" #include "util/simd_utils.h" #include @@ -385,8 +386,11 @@ hwlm_error_t noodExecStreaming(const struct noodTable *n, const u8 *hbuf, size_t tl2 = MIN(n->len - 1, len); size_t temp_len = tl1 + tl2; assert(temp_len < sizeof(temp_buf)); - memcpy(temp_buf, hbuf + hlen - tl1, tl1); - memcpy(temp_buf + tl1, buf, tl2); + assert(tl1 <= sizeof(u64a)); + assert(tl2 <= sizeof(u64a)); + unaligned_store_u64a(temp_buf, + partial_load_u64a(hbuf + hlen - tl1, tl1)); + unaligned_store_u64a(temp_buf + tl1, partial_load_u64a(buf, tl2)); cbi.offsetAdj = -tl1; rv = scan(temp_buf, temp_len, n->str, n->len, n->key_offset, n->nocase,