1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

add kernel version of memcmp

This commit is contained in:
Stefan Lankes 2015-09-13 21:22:00 +02:00
parent 650d159213
commit 2e9fb73007
5 changed files with 26 additions and 0 deletions

4
.gitmodules vendored
View file

@ -18,3 +18,7 @@
path = hermit/usr/newlib
url = git@github.com:RWTH-OS/newlib.git
branch = hermit
[submodule "hermit/lwip"]
path = hermit/lwip
url = git@github.com:RWTH-OS/LwIP.git
branch = hermit

View file

@ -2,6 +2,7 @@ TODO list
=========
* using a unified term for cores and CPUs, currently we didn't differentiate
* fast implementation of memcmp is missing
* prioririty handling in the Pthread library is still missing
* support of signals is still missing
* use gs register to accelerate tha access to newlib's reentrant structure

View file

@ -49,6 +49,10 @@ void *memcpy(void *dest, const void *src, size_t count);
void *memset(void *dest, int val, size_t count);
#endif
#ifndef HAVE_ARCH_MEMCMP
int memcmp(const void *s1, const void *s2, size_t n);
#endif
#ifndef HAVE_ARCH_STRLEN
size_t strlen(const char *str);
#endif

View file

@ -40,6 +40,22 @@ void *memset(void *dest, int val, size_t count)
}
#endif
#ifndef HAVE_ARCH_MEMCMP
int memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0) {
const unsigned char *p1 = s1, *p2 = s2;
do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while(--n != 0);
}
return 0;
}
#endif
#ifndef HAVE_ARCH_STRLEN
size_t strlen(const char *str)
{

1
hermit/lwip Submodule

@ -0,0 +1 @@
Subproject commit 5b8b5d459e7dd890724515bbfad86c705234f9ec