Import 2.3.18pre1
[davej-history.git] / include / asm-alpha / string.h
blob8f87ba2cb5d62e2595758b234429b10eaa2e0666
1 #ifndef __ALPHA_STRING_H__
2 #define __ALPHA_STRING_H__
4 #ifdef __KERNEL__
6 /*
7 * GCC of any recent vintage doesn't do stupid things with bcopy.
8 * EGCS 1.1 knows all about expanding memcpy inline, others don't.
10 * Similarly for a memset with data = 0.
13 #define __HAVE_ARCH_MEMCPY
14 #define __HAVE_ARCH_MEMMOVE
15 /* For backward compatibility with modules. Unused otherwise. */
16 extern void * __memcpy(void *, const void *, size_t);
18 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
19 #define memcpy __builtin_memcpy
20 #endif
22 #define __HAVE_ARCH_MEMSET
23 extern void * __constant_c_memset(void *, unsigned long, size_t);
24 extern void * __memset(void *, int, size_t);
26 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
27 #define memset(s, c, n) \
28 (__builtin_constant_p(c) \
29 ? (__builtin_constant_p(n) && (c) == 0 \
30 ? __builtin_memset((s),0,(n)) \
31 : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
32 : __memset((s),(c),(n)))
33 #else
34 #define memset(s, c, n) \
35 (__builtin_constant_p(c) \
36 ? __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n)) \
37 : __memset((s),(c),(n)))
38 #endif
40 #define __HAVE_ARCH_STRCPY
41 #define __HAVE_ARCH_STRNCPY
42 #define __HAVE_ARCH_STRCAT
43 #define __HAVE_ARCH_STRNCAT
44 #define __HAVE_ARCH_STRCHR
45 #define __HAVE_ARCH_STRRCHR
46 #define __HAVE_ARCH_STRLEN
47 #define __HAVE_ARCH_MEMCHR
49 /* The following routine is like memset except that it writes 16-bit
50 aligned values. The DEST and COUNT parameters must be even for
51 correct operation. */
53 #define __HAVE_ARCH_MEMSETW
54 extern void * __memsetw(void *dest, unsigned short, size_t count);
56 #define memsetw(s, c, n) \
57 (__builtin_constant_p(c) \
58 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
59 : __memsetw((s),(c),(n)))
61 extern int strcasecmp(const char *, const char *);
63 #endif /* __KERNEL__ */
65 #endif /* __ALPHA_STRING_H__ */