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)
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
11 #ifndef __ASM_NDS_STRING_H
12 #define __ASM_NDS_STRING_H
15 * We don't do inline string functions, since the
16 * optimised inline asm versions are not small.
19 #undef __HAVE_ARCH_STRRCHR
20 extern char *strrchr(const char *s, int c);
22 #undef __HAVE_ARCH_STRCHR
23 extern char *strchr(const char *s, int c);
25 #undef __HAVE_ARCH_MEMCPY
26 extern void *memcpy(void *, const void *, __kernel_size_t);
28 #undef __HAVE_ARCH_MEMMOVE
29 extern void *memmove(void *, const void *, __kernel_size_t);
31 #undef __HAVE_ARCH_MEMCHR
32 extern void *memchr(const void *, int, __kernel_size_t);
34 #undef __HAVE_ARCH_MEMZERO
35 #undef __HAVE_ARCH_MEMSET
36 extern void *memset(void *, int, __kernel_size_t);
38 #ifdef CONFIG_MARCO_MEMSET
39 extern void __memzero(void *ptr, __kernel_size_t n);
41 #define memset(p, v, n) \
44 if (__builtin_constant_p((v)) && (v) == 0) \
45 __memzero((p), (n)); \
47 memset((p), (v), (n)); \
52 #define memzero(p, n) ({ if ((n) != 0) __memzero((p), (n)); (p); })
54 extern void memzero(void *ptr, __kernel_size_t n);
57 #endif /* __ASM_NDS_STRING_H */