MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / memmove

Function memmove

stdlib/cpp/utility.hpp:7–20  ·  view source on GitHub ↗

Custom memmove

Source from the content-addressed store, hash-verified

5
6// Custom memmove
7void* memmove(void* dest, const void* src, std::size_t n) {
8 char* csrc = (char*)src;
9 char* cdest = (char*)dest;
10 if (csrc < cdest) {
11 for (std::size_t i = n; i > 0; i--) {
12 cdest[i - 1] = csrc[i - 1];
13 }
14 } else {
15 for (std::size_t i = 0; i < n; i++) {
16 cdest[i] = csrc[i];
17 }
18 }
19 return dest;
20}
21
22namespace std {
23 // make std::move using memmove (3 arguments, specific use case)

Callers 1

moveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected