1 #ifndef __ASM_SH_STRING_H
2 #define __ASM_SH_STRING_H
5 * Copyright (C) 1999 Niibe Yutaka
6 * But consider these trivial functions to be public domain.
8 * from linux kernel code.
11 #ifdef __KERNEL__ /* only set these up for kernel code */
13 #define __HAVE_ARCH_STRCPY
14 static inline char *strcpy(char *__dest, const char *__src)
16 register char *__xdest = __dest;
17 unsigned long __dummy;
19 __asm__ __volatile__("1:\n\t"
25 : "=r" (__dest), "=r" (__src), "=&z" (__dummy)
26 : "0" (__dest), "1" (__src)
32 #define __HAVE_ARCH_STRNCPY
33 static inline char *strncpy(char *__dest, const char *__src, size_t __n)
35 register char *__xdest = __dest;
36 unsigned long __dummy;
51 : "=r" (__dest), "=r" (__src), "=&z" (__dummy)
52 : "0" (__dest), "1" (__src), "r" (__src+__n)
58 #define __HAVE_ARCH_STRCMP
59 static inline int strcmp(const char *__cs, const char *__ct)
62 unsigned long __dummy;
77 : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
78 : "0" (__cs), "1" (__ct)
84 #define __HAVE_ARCH_STRNCMP
85 static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
88 unsigned long __dummy;
103 " mov.b @%1+, %3\n\t"
109 :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
110 : "0" (__cs), "1" (__ct), "r" (__cs+__n)
116 #undef __HAVE_ARCH_MEMSET
117 extern void *memset(void *__s, int __c, size_t __count);
119 #undef __HAVE_ARCH_MEMCPY
120 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
122 #undef __HAVE_ARCH_MEMMOVE
123 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
125 #undef __HAVE_ARCH_MEMCHR
126 extern void *memchr(const void *__s, int __c, size_t __n);
128 #undef __HAVE_ARCH_STRLEN
129 extern size_t strlen(const char *);
131 /* arch/sh/lib/strcasecmp.c */
132 extern int strcasecmp(const char *, const char *);
137 * let user libraries deal with these,
138 * IMHO the kernel has no place defining these functions for user apps
141 #define __HAVE_ARCH_STRCPY 1
142 #define __HAVE_ARCH_STRNCPY 1
143 #define __HAVE_ARCH_STRCAT 1
144 #define __HAVE_ARCH_STRNCAT 1
145 #define __HAVE_ARCH_STRCMP 1
146 #define __HAVE_ARCH_STRNCMP 1
147 #define __HAVE_ARCH_STRNICMP 1
148 #define __HAVE_ARCH_STRCHR 1
149 #define __HAVE_ARCH_STRRCHR 1
150 #define __HAVE_ARCH_STRSTR 1
151 #define __HAVE_ARCH_STRLEN 1
152 #define __HAVE_ARCH_STRNLEN 1
153 #define __HAVE_ARCH_MEMSET 1
154 #define __HAVE_ARCH_MEMCPY 1
155 #define __HAVE_ARCH_MEMMOVE 1
156 #define __HAVE_ARCH_MEMSCAN 1
157 #define __HAVE_ARCH_MEMCMP 1
158 #define __HAVE_ARCH_MEMCHR 1
159 #define __HAVE_ARCH_STRTOK 1
162 #endif /* __ASM_SH_STRING_H */