2 * arch/arm/boot/compressed/string.c
4 * Small subset of simple string routines
7 #include <linux/string.h>
9 void *memcpy(void *__dest
, __const
void *__src
, size_t __n
)
12 unsigned char *d
= (unsigned char *)__dest
, *s
= (unsigned char *)__src
;
14 for (i
= __n
>> 3; i
> 0; i
--) {
43 void *memmove(void *__dest
, __const
void *__src
, size_t count
)
45 unsigned char *d
= __dest
;
46 const unsigned char *s
= __src
;
52 return memcpy(__dest
, __src
, count
);
59 size_t strlen(const char *s
)
68 size_t strnlen(const char *s
, size_t count
)
72 for (sc
= s
; count
-- && *sc
!= '\0'; ++sc
)
77 int memcmp(const void *cs
, const void *ct
, size_t count
)
79 const unsigned char *su1
= cs
, *su2
= ct
, *end
= su1
+ count
;
83 res
= *su1
++ - *su2
++;
90 int strcmp(const char *cs
, const char *ct
)
105 void *memchr(const void *s
, int c
, size_t count
)
107 const unsigned char *p
= s
;
110 if ((unsigned char)c
== *p
++)
111 return (void *)(p
- 1);
115 char *strchr(const char *s
, int c
)
117 while (*s
!= (char)c
)
125 void *memset(void *s
, int c
, size_t count
)
133 void __memzero(void *s
, size_t count
)