[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / target / linux / generic / patches-2.6.30 / 202-mips_mem_functions_performance.patch
1 --- a/arch/mips/include/asm/string.h
2 +++ b/arch/mips/include/asm/string.h
3 @@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__
4
5 #define __HAVE_ARCH_MEMSET
6 extern void *memset(void *__s, int __c, size_t __count);
7 +#define memset(__s, __c, len) \
8 +({ \
9 + size_t __len = (len); \
10 + void *__ret; \
11 + if (__builtin_constant_p(len) && __len >= 64) \
12 + __ret = memset((__s), (__c), __len); \
13 + else \
14 + __ret = __builtin_memset((__s), (__c), __len); \
15 + __ret; \
16 +})
17
18 #define __HAVE_ARCH_MEMCPY
19 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
20 +#define memcpy(dst, src, len) \
21 +({ \
22 + size_t __len = (len); \
23 + void *__ret; \
24 + if (__builtin_constant_p(len) && __len >= 64) \
25 + __ret = memcpy((dst), (src), __len); \
26 + else \
27 + __ret = __builtin_memcpy((dst), (src), __len); \
28 + __ret; \
29 +})
30
31 #define __HAVE_ARCH_MEMMOVE
32 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
33 +#define memmove(dst, src, len) \
34 +({ \
35 + size_t __len = (len); \
36 + void *__ret; \
37 + if (__builtin_constant_p(len) && __len >= 64) \
38 + __ret = memmove((dst), (src), __len); \
39 + else \
40 + __ret = __builtin_memmove((dst), (src), __len); \
41 + __ret; \
42 +})
43 +
44 +#define __HAVE_ARCH_MEMCMP
45 +#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len))
46
47 #endif /* _ASM_STRING_H */
48 --- a/arch/mips/lib/Makefile
49 +++ b/arch/mips/lib/Makefile
50 @@ -3,7 +3,7 @@
51 #
52
53 lib-y += csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \
54 - strlen_user.o strncpy_user.o strnlen_user.o uncached.o
55 + strlen_user.o strncpy_user.o strnlen_user.o uncached.o memcmp.o
56
57 obj-y += iomap.o
58 obj-$(CONFIG_PCI) += iomap-pci.o
59 --- /dev/null
60 +++ b/arch/mips/lib/memcmp.c
61 @@ -0,0 +1,22 @@
62 +/*
63 + * copied from linux/lib/string.c
64 + *
65 + * Copyright (C) 1991, 1992 Linus Torvalds
66 + */
67 +
68 +#include <linux/module.h>
69 +#include <linux/string.h>
70 +
71 +#undef memcmp
72 +int memcmp(const void *cs, const void *ct, size_t count)
73 +{
74 + const unsigned char *su1, *su2;
75 + int res = 0;
76 +
77 + for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
78 + if ((res = *su1 - *su2) != 0)
79 + break;
80 + return res;
81 +}
82 +EXPORT_SYMBOL(memcmp);
83 +
This page took 0.045007 seconds and 5 git commands to generate.