diff options
Diffstat (limited to 'arch/alpha/include/asm/string.h')
-rw-r--r-- | arch/alpha/include/asm/string.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/arch/alpha/include/asm/string.h b/arch/alpha/include/asm/string.h index b02b8a282940..c2911f591704 100644 --- a/arch/alpha/include/asm/string.h +++ b/arch/alpha/include/asm/string.h | |||
@@ -22,15 +22,27 @@ extern void * __memcpy(void *, const void *, size_t); | |||
22 | 22 | ||
23 | #define __HAVE_ARCH_MEMSET | 23 | #define __HAVE_ARCH_MEMSET |
24 | extern void * __constant_c_memset(void *, unsigned long, size_t); | 24 | extern void * __constant_c_memset(void *, unsigned long, size_t); |
25 | extern void * ___memset(void *, int, size_t); | ||
25 | extern void * __memset(void *, int, size_t); | 26 | extern void * __memset(void *, int, size_t); |
26 | extern void * memset(void *, int, size_t); | 27 | extern void * memset(void *, int, size_t); |
27 | 28 | ||
28 | #define memset(s, c, n) \ | 29 | /* For gcc 3.x, we cannot have the inline function named "memset" because |
29 | (__builtin_constant_p(c) \ | 30 | the __builtin_memset will attempt to resolve to the inline as well, |
30 | ? (__builtin_constant_p(n) && (c) == 0 \ | 31 | leading to a "sorry" about unimplemented recursive inlining. */ |
31 | ? __builtin_memset((s),0,(n)) \ | 32 | extern inline void *__memset(void *s, int c, size_t n) |
32 | : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \ | 33 | { |
33 | : __memset((s),(c),(n))) | 34 | if (__builtin_constant_p(c)) { |
35 | if (__builtin_constant_p(n)) { | ||
36 | return __builtin_memset(s, c, n); | ||
37 | } else { | ||
38 | unsigned long c8 = (c & 0xff) * 0x0101010101010101UL; | ||
39 | return __constant_c_memset(s, c8, n); | ||
40 | } | ||
41 | } | ||
42 | return ___memset(s, c, n); | ||
43 | } | ||
44 | |||
45 | #define memset __memset | ||
34 | 46 | ||
35 | #define __HAVE_ARCH_STRCPY | 47 | #define __HAVE_ARCH_STRCPY |
36 | extern char * strcpy(char *,const char *); | 48 | extern char * strcpy(char *,const char *); |