xref: /openbmc/u-boot/arch/arm/include/asm/string.h (revision 85231c08)
1 #ifndef __ASM_ARM_STRING_H
2 #define __ASM_ARM_STRING_H
3 
4 #include <config.h>
5 
6 /*
7  * We don't do inline string functions, since the
8  * optimised inline asm versions are not small.
9  */
10 
11 #undef __HAVE_ARCH_STRRCHR
12 extern char * strrchr(const char * s, int c);
13 
14 #undef __HAVE_ARCH_STRCHR
15 extern char * strchr(const char * s, int c);
16 
17 #if CONFIG_IS_ENABLED(USE_ARCH_MEMCPY)
18 #define __HAVE_ARCH_MEMCPY
19 #endif
20 extern void * memcpy(void *, const void *, __kernel_size_t);
21 
22 #undef __HAVE_ARCH_MEMMOVE
23 extern void * memmove(void *, const void *, __kernel_size_t);
24 
25 #undef __HAVE_ARCH_MEMCHR
26 extern void * memchr(const void *, int, __kernel_size_t);
27 
28 #undef __HAVE_ARCH_MEMZERO
29 #if CONFIG_IS_ENABLED(USE_ARCH_MEMSET)
30 #define __HAVE_ARCH_MEMSET
31 #endif
32 extern void * memset(void *, int, __kernel_size_t);
33 
34 #if 0
35 extern void __memzero(void *ptr, __kernel_size_t n);
36 
37 #define memset(p,v,n)							\
38 	({								\
39 		if ((n) != 0) {						\
40 			if (__builtin_constant_p((v)) && (v) == 0)	\
41 				__memzero((p),(n));			\
42 			else						\
43 				memset((p),(v),(n));			\
44 		}							\
45 		(p);							\
46 	})
47 
48 #define memzero(p,n) ({ if ((n) != 0) __memzero((p),(n)); (p); })
49 #else
50 extern void memzero(void *ptr, __kernel_size_t n);
51 #endif
52 
53 #endif
54