Files
android/arch/nios2/lib/memmove.c
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

81 lines
1.4 KiB
C

/*
* Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
* Copyright (C) 2004 Microtronix Datacom Ltd
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/types.h>
#include <linux/string.h>
void *memmove(void *d, const void *s, size_t count)
{
unsigned long dst, src;
if (!count)
return d;
if (d < s) {
dst = (unsigned long) d;
src = (unsigned long) s;
if ((count < 8) || ((dst ^ src) & 3))
goto restup;
if (dst & 1) {
*(char *)dst++ = *(char *)src++;
count--;
}
if (dst & 2) {
*(short *)dst = *(short *)src;
src += 2;
dst += 2;
count -= 2;
}
while (count > 3) {
*(long *)dst = *(long *)src;
src += 4;
dst += 4;
count -= 4;
}
restup:
while (count--)
*(char *)dst++ = *(char *)src++;
} else {
dst = (unsigned long) d + count;
src = (unsigned long) s + count;
if ((count < 8) || ((dst ^ src) & 3))
goto restdown;
if (dst & 1) {
src--;
dst--;
count--;
*(char *)dst = *(char *)src;
}
if (dst & 2) {
src -= 2;
dst -= 2;
count -= 2;
*(short *)dst = *(short *)src;
}
while (count > 3) {
src -= 4;
dst -= 4;
count -= 4;
*(long *)dst = *(long *)src;
}
restdown:
while (count--) {
src--;
dst--;
*(char *)dst = *(char *)src;
}
}
return d;
}