diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/components/utilities/utclib.c | 55 | ||||
-rw-r--r-- | source/include/acclib.h | 6 |
2 files changed, 61 insertions, 0 deletions
diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index 26fbaf958..d2f73642f 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -201,6 +201,61 @@ memcmp ( /******************************************************************************* * + * FUNCTION: memmove + * + * PARAMETERS: Dest - Target of the copy + * Src - Source buffer to copy + * Count - Number of bytes to copy + * + * RETURN: Dest + * + * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping + * + ******************************************************************************/ + +void * +memmove ( + void *Dest, + const void *Src, + ACPI_SIZE Count) +{ + char *New = (char *) Dest; + char *Old = (char *) Src; + + + if (Old > New) + { + /* Copy from the beginning */ + + while (Count) + { + *New = *Old; + New++; + Old++; + Count--; + } + } + else if (Old < New) + { + /* Copy from the end */ + + New = New + Count - 1; + Old = Old + Count - 1; + while (Count) + { + *New = *Old; + New--; + Old--; + Count--; + } + } + + return (Dest); +} + + +/******************************************************************************* + * * FUNCTION: memcpy * * PARAMETERS: Dest - Target of the copy diff --git a/source/include/acclib.h b/source/include/acclib.h index f18f2b8b7..e917dd88d 100644 --- a/source/include/acclib.h +++ b/source/include/acclib.h @@ -237,6 +237,12 @@ memcpy ( ACPI_SIZE Count); void * +memmove ( + void *Dest, + const void *Src, + ACPI_SIZE Count); + +void * memset ( void *Dest, int Value, |