Integrate LZ4 library, compress the ramdisk
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m53s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m53s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef _KERNEL_LIBK_ASSERT_H
|
||||
#define _KERNEL_LIBK_ASSERT_H
|
||||
|
||||
#include <sys/debug.h>
|
||||
#include <sys/spin.h>
|
||||
|
||||
#define assert(x) \
|
||||
|
||||
@@ -9,13 +9,13 @@ size_t memset (void* dst, uint8_t b, size_t n) {
|
||||
return i;
|
||||
}
|
||||
|
||||
size_t memcpy (void* dst, const void* src, size_t n) {
|
||||
void* memcpy (void* dst, const void* src, size_t n) {
|
||||
uint8_t* dst1 = dst;
|
||||
const uint8_t* src1 = src;
|
||||
size_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
dst1[i] = src1[i];
|
||||
return i;
|
||||
return dst;
|
||||
}
|
||||
|
||||
// SOURCE: https://stackoverflow.com/a/48967408
|
||||
@@ -92,3 +92,24 @@ char* strncat (char* dest, const char* src, size_t n) {
|
||||
*ptr = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
void* memmove (void* dest, const void* src, unsigned int n) {
|
||||
unsigned char isCopyRequire = 0; // flag bit
|
||||
char* pcSource = (char*)src;
|
||||
char* pcDstn = (char*)dest;
|
||||
// return if pcDstn and pcSource is NULL
|
||||
if ((pcSource == NULL) || (pcDstn == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
// overlap buffer
|
||||
if ((pcSource < pcDstn) && (pcDstn < pcSource + n)) {
|
||||
for (pcDstn += n, pcSource += n; n--;) {
|
||||
*--pcDstn = *--pcSource;
|
||||
}
|
||||
} else {
|
||||
while (n--) {
|
||||
*pcDstn++ = *pcSource++;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,23 @@
|
||||
#include <libk/std.h>
|
||||
|
||||
size_t memset (void* dst, uint8_t b, size_t n);
|
||||
size_t memcpy (void* dst, const void* src, size_t n);
|
||||
|
||||
void* memcpy (void* dst, const void* src, size_t n);
|
||||
|
||||
void strncpy (char* dst, const char* src, size_t n);
|
||||
|
||||
size_t strlen (const char* str);
|
||||
|
||||
int memcmp (const void* s1, const void* s2, size_t n);
|
||||
|
||||
int strncmp (const char* s1, const char* s2, size_t n);
|
||||
|
||||
int strcmp (const char* s1, const char* s2);
|
||||
|
||||
char* strncat (char* dest, const char* src, size_t n);
|
||||
|
||||
void* memmove (void* dest, const void* src, unsigned int n);
|
||||
|
||||
#define strlen_null(x) (strlen ((x)) + 1)
|
||||
|
||||
#endif // _KERNEL_LIBK_STRING_H
|
||||
|
||||
Reference in New Issue
Block a user