ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-alpha / string.h
1 #ifndef __ALPHA_STRING_H__
2 #define __ALPHA_STRING_H__
3
4 #ifdef __KERNEL__
5
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.
9  *
10  * Similarly for a memset with data = 0.
11  */
12
13 #define __HAVE_ARCH_MEMCPY
14 extern void * memcpy(void *, const void *, size_t);
15 #define __HAVE_ARCH_MEMMOVE
16 #define __HAVE_ARCH_BCOPY
17 extern void * memmove(void *, const void *, size_t);
18
19 /* For backward compatibility with modules.  Unused otherwise.  */
20 extern void * __memcpy(void *, const void *, size_t);
21
22 #define memcpy __builtin_memcpy
23
24 #define __HAVE_ARCH_MEMSET
25 extern void * __constant_c_memset(void *, unsigned long, size_t);
26 extern void * __memset(void *, int, size_t);
27 extern void * memset(void *, int, size_t);
28
29 #define memset(s, c, n)                                                     \
30 (__builtin_constant_p(c)                                                    \
31  ? (__builtin_constant_p(n) && (c) == 0                                     \
32     ? __builtin_memset((s),0,(n))                                           \
33     : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
34  : __memset((s),(c),(n)))
35
36 #define __HAVE_ARCH_STRCPY
37 extern char * strcpy(char *,const char *);
38 #define __HAVE_ARCH_STRNCPY
39 extern char * strncpy(char *, const char *, size_t);
40 #define __HAVE_ARCH_STRCAT
41 extern char * strcat(char *, const char *);
42 #define __HAVE_ARCH_STRNCAT
43 extern char * strncat(char *, const char *, size_t);
44 #define __HAVE_ARCH_STRCHR
45 extern char * strchr(const char *,int);
46 #define __HAVE_ARCH_STRRCHR
47 extern char * strrchr(const char *,int);
48 #define __HAVE_ARCH_STRLEN
49 extern size_t strlen(const char *);
50 #define __HAVE_ARCH_MEMCHR
51 extern void * memchr(const void *, int, size_t);
52
53 /* The following routine is like memset except that it writes 16-bit
54    aligned values.  The DEST and COUNT parameters must be even for 
55    correct operation.  */
56
57 #define __HAVE_ARCH_MEMSETW
58 extern void * __memsetw(void *dest, unsigned short, size_t count);
59
60 #define memsetw(s, c, n)                                                 \
61 (__builtin_constant_p(c)                                                 \
62  ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
63  : __memsetw((s),(c),(n)))
64
65 extern int strcasecmp(const char *, const char *);
66
67 #endif /* __KERNEL__ */
68
69 #endif /* __ALPHA_STRING_H__ */