Skip to content

Commit

Permalink
memcpy: return pointer to dest, as per standard
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Nov 7, 2023
1 parent 5679628 commit de2f129
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ int memcmp(const void* s1, const void* s2, size_t n) {
}

extern "C"
void memcpy(void* dest, const void* src, size_t n) {
void* memcpy(void* dest, const void* src, size_t n) {
void* orig_dest = dest;

#if __INTPTR_WIDTH__ == 64
while (n >= sizeof(uint64_t)) {
*(uint64_t*)dest = *(uint64_t*)src;
Expand Down Expand Up @@ -151,6 +153,8 @@ void memcpy(void* dest, const void* src, size_t n) {

n -= sizeof(uint8_t);
}

return orig_dest;
}

const char* error_string(EFI_STATUS Status) {
Expand Down

0 comments on commit de2f129

Please sign in to comment.