1 // SPDX-License-Identifier: GPL-2.0
3 * arch/arm/boot/compressed/string.c
5 * Small subset of simple string routines
8 #include <linux/string.h>
10 void *memcpy(void *__dest
, __const
void *__src
, size_t __n
)
13 unsigned char *d
= (unsigned char *)__dest
, *s
= (unsigned char *)__src
;
15 for (i
= __n
>> 3; i
> 0; i
--) {
44 void *memmove(void *__dest
, __const
void *__src
, size_t count
)
46 unsigned char *d
= __dest
;
47 const unsigned char *s
= __src
;
53 return memcpy(__dest
, __src
, count
);
60 size_t strlen(const char *s
)
69 size_t strnlen(const char *s
, size_t count
)
73 for (sc
= s
; count
-- && *sc
!= '\0'; ++sc
)
78 int memcmp(const void *cs
, const void *ct
, size_t count
)
80 const unsigned char *su1
= cs
, *su2
= ct
, *end
= su1
+ count
;
84 res
= *su1
++ - *su2
++;
91 int strcmp(const char *cs
, const char *ct
)
106 void *memchr(const void *s
, int c
, size_t count
)
108 const unsigned char *p
= s
;
111 if ((unsigned char)c
== *p
++)
112 return (void *)(p
- 1);
116 char *strchr(const char *s
, int c
)
118 while (*s
!= (char)c
)
126 void *memset(void *s
, int c
, size_t count
)