summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch')
-rw-r--r--meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch b/meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch
new file mode 100644
index 0000000000..c26891b46f
--- /dev/null
+++ b/meta/recipes-support/lzo/lzo/0001-Use-memcpy-instead-of-reinventing-it.patch
@@ -0,0 +1,70 @@
1From: Simon McVittie <smcv@debian.org>
2Date: Sun, 23 Nov 2014 22:50:33 +0000
3Subject: Use memcpy() instead of reinventing it
4
5gcc inlines memcpy() with results as fast as handwritten code (at
6least in my brief testing with lzop), and knows the alignment
7constraints for our architectures.
8
9Change suggested by Julian Taylor.
10
11Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757037
12
13Upstream-Status: Pending
14Signed-off-by: Saul Wold <sgw@linux.intel.com>
15---
16 minilzo/minilzo.c | 14 ++++++++++++++
17 src/lzo_func.h | 14 ++++++++++++++
18 2 files changed, 28 insertions(+)
19
20
21diff --git a/minilzo/minilzo.c b/minilzo/minilzo.c
22index ab2be5f..6913c2f 100644
23--- a/minilzo/minilzo.c
24+++ b/minilzo/minilzo.c
25@@ -3523,6 +3523,20 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
26 if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \
27 LZO_BLOCK_END
28
29+/* Debian-specific change: we know that our compiler inlines memcpy() with
30+ * constant n to be as fast as handwritten code, and knows which architectures
31+ * need things correctly aligned. */
32+#undef LZO_MEMOPS_COPY1
33+#undef LZO_MEMOPS_COPY2
34+#undef LZO_MEMOPS_COPY4
35+#undef LZO_MEMOPS_COPY8
36+#undef LZO_MEMOPS_COPYN
37+#define LZO_MEMOPS_COPY1(dd,ss) memcpy(dd, ss, 1)
38+#define LZO_MEMOPS_COPY2(dd,ss) memcpy(dd, ss, 2)
39+#define LZO_MEMOPS_COPY4(dd,ss) memcpy(dd, ss, 4)
40+#define LZO_MEMOPS_COPY8(dd,ss) memcpy(dd, ss, 8)
41+#define LZO_MEMOPS_COPYN(dd,ss,nn) memcpy(dd, ss, nn)
42+
43 __lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss)
44 {
45 lzo_uint16_t v;
46diff --git a/src/lzo_func.h b/src/lzo_func.h
47index dfaa676..1cc1b53 100644
48--- a/src/lzo_func.h
49+++ b/src/lzo_func.h
50@@ -333,6 +333,20 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
51 if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \
52 LZO_BLOCK_END
53
54+/* Debian-specific change: we know that our compiler inlines memcpy() with
55+ * constant n to be as fast as handwritten code, and knows which architectures
56+ * need things correctly aligned. */
57+#undef LZO_MEMOPS_COPY1
58+#undef LZO_MEMOPS_COPY2
59+#undef LZO_MEMOPS_COPY4
60+#undef LZO_MEMOPS_COPY8
61+#undef LZO_MEMOPS_COPYN
62+#define LZO_MEMOPS_COPY1(dd,ss) memcpy(dd, ss, 1)
63+#define LZO_MEMOPS_COPY2(dd,ss) memcpy(dd, ss, 2)
64+#define LZO_MEMOPS_COPY4(dd,ss) memcpy(dd, ss, 4)
65+#define LZO_MEMOPS_COPY8(dd,ss) memcpy(dd, ss, 8)
66+#define LZO_MEMOPS_COPYN(dd,ss,nn) memcpy(dd, ss, nn)
67+
68 __lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss)
69 {
70 lzo_uint16_t v;