1 #if !defined(_STRSUP_H) && defined(__OPTIMIZE__)
7 extern __inline__
void *memcpy(void *s1
,const void *s2
,size_t n
)
8 { register char *a6
__asm("a6") = *(char **)4;
9 register const void *a0
__asm("a0") = s2
;
10 register const void *a1
__asm("a1") = s1
;
11 register size_t d0
__asm("d0") = n
;
12 __asm
__volatile ("jsr a6@(-0x270)"
14 : "r" (a6
), "r" (a0
), "r" (a1
), "r" (d0
)
15 : "a0","a1","d0","d1", "memory");
20 extern __inline__
void *memmove(void *s1
,const void *s2
,size_t n
)
22 bcopy(s2
,s1
,n
); return s1
;
25 extern __inline__
void *memset(void *s
,int c
,size_t n
)
36 extern __inline__
int memcmp(const void *s1
,const void *s2
,size_t n
)
37 { const unsigned char *p1
=s1
,*p2
=s2
;
44 ((unsigned char)c
)=*p2
++;
45 } while(!(r
-=c
) && --n
);
50 extern __inline__
void *memchr(const void *s
,int c
,size_t n
)
53 unsigned char *p
=(unsigned char *)s
;
55 if (*p
++==(unsigned char)c
)
62 extern __inline__
size_t strlen_plus_one(const char *string
)
63 { const char *s
=string
;
65 do{}while(*s
++); return (s
-string
);
68 extern __inline__
size_t strlen(const char *string
)
69 { const char *s
=string
;
71 do{}while(*s
++); return ~(string
-s
);
74 extern __inline__
char *strcpy(char *s1
,const char *s2
)
83 extern __inline__
char *strncpy(char *s1
,const char *s2
,size_t n
)
88 do{}while((*s
++=*s2
++) && (--n
!= 0));
90 while(--n
!= 0) *s
++=0;
95 extern __inline__
char *strcat(char *s1
,const char *s2
)
98 do{}while(*s
++); --s
; do{}while((*s
++=*s2
++)); return s1
;
101 extern __inline__
char *strncat(char *s1
,const char *s2
,size_t n
)
106 do{}while(*s
++); --s
;
118 extern __inline__
int strcmp(const char *s1
,const char *s2
)
119 { const unsigned char *p1
=s1
,*p2
=s2
;
125 ((unsigned char)c
)=*p2
++;
126 } while(!(r
-=c
) && (unsigned char)c
);
130 extern __inline__
int strncmp(const char *s1
,const char *s2
,size_t n
)
131 { const unsigned char *p1
=s1
,*p2
=s2
;
138 ((unsigned char)c
)=*p2
++;
139 } while(!(r
-=c
) && (unsigned char)c
&& --n
);
144 extern __inline__
char *strchr(const char *s
,int c
)
152 extern __inline__
char *strupr(char *s
)
153 { unsigned char *s1
=(unsigned char *)s
;
156 if ((*s1
>('a'-1)) && (*s1
<('z'+1)))
163 extern __inline__
char *strlwr(char *s
)
164 { unsigned char *s1
=(unsigned char *)s
;
167 if ((*s1
>('A'-1)) && (*s1
<('Z'+1)))
174 extern __inline__
char *stpcpy(char *dst
,char *src
)
176 do{}while((*dst
++=*src
++)); return(dst
-1);
179 #elif !defined(__OPTIMIZE__)
181 #define strlen_plus_one(s) strlen(s)+1L
183 #endif /* _STRSUP_H */