]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
noodle: we don't need memcpy
authorMatthew Barr <matthew.barr@intel.com>
Tue, 30 May 2017 06:26:13 +0000 (16:26 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:10:20 +0000 (11:10 +1000)
src/hwlm/noodle_engine.c

index 0370ef31af24a1e05c9502d47958e0188e93f6a8..4897eb091c33f4859a5ac4a01a69e3a4d9aadb18 100644 (file)
@@ -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 <ctype.h>
@@ -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,