1 /*
2  * Copyright (C) 2011 Andes Technology Corporation
3  * Copyright (C) 2010 Shawn Lin (nobuhiro@andestech.com)
4  * Copyright (C) 2011 Macpaul Lin (macpaul@andestech.com)
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License.  See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 
11 #ifndef __ASM_NDS_STRING_H
12 #define __ASM_NDS_STRING_H
13 
14 /*
15  * We don't do inline string functions, since the
16  * optimised inline asm versions are not small.
17  */
18 
19 #undef __HAVE_ARCH_STRRCHR
20 extern char *strrchr(const char *s, int c);
21 
22 #undef __HAVE_ARCH_STRCHR
23 extern char *strchr(const char *s, int c);
24 
25 #undef __HAVE_ARCH_MEMCPY
26 extern void *memcpy(void *, const void *, __kernel_size_t);
27 
28 #undef __HAVE_ARCH_MEMMOVE
29 extern void *memmove(void *, const void *, __kernel_size_t);
30 
31 #undef __HAVE_ARCH_MEMCHR
32 extern void *memchr(const void *, int, __kernel_size_t);
33 
34 #undef __HAVE_ARCH_MEMZERO
35 #undef __HAVE_ARCH_MEMSET
36 extern void *memset(void *, int, __kernel_size_t);
37 
38 #ifdef CONFIG_MARCO_MEMSET
39 extern void __memzero(void *ptr, __kernel_size_t n);
40 
41 #define memset(p, v, n)							\
42 	({								\
43 		if ((n) != 0) {						\
44 			if (__builtin_constant_p((v)) && (v) == 0)	\
45 				__memzero((p), (n));			\
46 			else						\
47 				memset((p), (v), (n));			\
48 		}							\
49 		(p);							\
50 	})
51 
52 #define memzero(p, n) ({ if ((n) != 0) __memzero((p), (n)); (p); })
53 #else
54 extern void memzero(void *ptr, __kernel_size_t n);
55 #endif
56 
57 #endif /* __ASM_NDS_STRING_H */
58