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 #undef __HAVE_ARCH_STRNCMP
85 extern int strncmp(const char *__cs, const char *__ct, size_t __n);
87 #undef __HAVE_ARCH_MEMSET
88 extern void *memset(void *__s, int __c, size_t __count);
90 #undef __HAVE_ARCH_MEMCPY
91 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
93 #undef __HAVE_ARCH_MEMMOVE
94 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
96 #undef __HAVE_ARCH_MEMCHR
97 extern void *memchr(const void *__s, int __c, size_t __n);
99 #undef __HAVE_ARCH_STRLEN
100 extern size_t strlen(const char *);
102 /* arch/sh/lib/strcasecmp.c */
103 extern int strcasecmp(const char *, const char *);
108 * let user libraries deal with these,
109 * IMHO the kernel has no place defining these functions for user apps
112 #define __HAVE_ARCH_STRCPY 1
113 #define __HAVE_ARCH_STRNCPY 1
114 #define __HAVE_ARCH_STRCAT 1
115 #define __HAVE_ARCH_STRNCAT 1
116 #define __HAVE_ARCH_STRCMP 1
117 #define __HAVE_ARCH_STRNCMP 1
118 #define __HAVE_ARCH_STRNICMP 1
119 #define __HAVE_ARCH_STRCHR 1
120 #define __HAVE_ARCH_STRRCHR 1
121 #define __HAVE_ARCH_STRSTR 1
122 #define __HAVE_ARCH_STRLEN 1
123 #define __HAVE_ARCH_STRNLEN 1
124 #define __HAVE_ARCH_MEMSET 1
125 #define __HAVE_ARCH_MEMCPY 1
126 #define __HAVE_ARCH_MEMMOVE 1
127 #define __HAVE_ARCH_MEMSCAN 1
128 #define __HAVE_ARCH_MEMCMP 1
129 #define __HAVE_ARCH_MEMCHR 1
130 #define __HAVE_ARCH_STRTOK 1
133 #endif /* __ASM_SH_STRING_H */