mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibC: Support backwards copy in memmove().
This commit is contained in:
parent
84c4110a50
commit
c7ded89f05
Notes:
sideshowbarker
2024-07-19 15:58:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c7ded89f051
1 changed files with 6 additions and 2 deletions
|
@ -141,8 +141,12 @@ void* memmove(void* dest, const void* src, size_t n)
|
|||
{
|
||||
if (dest < src)
|
||||
return memcpy(dest, src, n);
|
||||
// FIXME: Implement backwards copy.
|
||||
assert(false);
|
||||
|
||||
byte *pd = (byte*)dest;
|
||||
const byte *ps = (const byte*)src;
|
||||
for (pd += n, ps += n; n--;)
|
||||
*--pd = *--ps;
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* strcpy(char* dest, const char *src)
|
||||
|
|
Loading…
Add table
Reference in a new issue