mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
Kernel+LibC: Implement 'memmem'
This commit adds an implementation of memmem, using the Bitap text search algorithm for needles smaller than 32 bytes, and a naive loop search for longer needles.
This commit is contained in:
parent
ad35436786
commit
1ad51325ad
5 changed files with 178 additions and 0 deletions
|
@ -54,6 +54,7 @@ char* strdup(const char*);
|
|||
int memcmp(const void*, const void*, size_t);
|
||||
char* strrchr(const char* str, int ch);
|
||||
void* memmove(void* dest, const void* src, size_t n);
|
||||
const void* memmem(const void* haystack, size_t, const void* needle, size_t);
|
||||
|
||||
inline u16 ntohs(u16 w) { return (w & 0xff) << 8 | ((w >> 8) & 0xff); }
|
||||
inline u16 htons(u16 w) { return (w & 0xff) << 8 | ((w >> 8) & 0xff); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue