[ox/std] Add memmove
This commit is contained in:
parent
2e71d288b4
commit
8dcd350671
4
deps/ox/src/ox/std/memops.cpp
vendored
4
deps/ox/src/ox/std/memops.cpp
vendored
@ -19,6 +19,10 @@ void *ox_inhibit_loop_to_libcall memcpy(void *dest, const void *src, std::size_t
|
||||
return ox_memcpy(dest, src, size);
|
||||
}
|
||||
|
||||
void *ox_inhibit_loop_to_libcall memmove(void *dest, const void *src, std::size_t size) {
|
||||
return ox_memcpy(dest, src, size);
|
||||
}
|
||||
|
||||
void *ox_inhibit_loop_to_libcall memset(void *ptr, int val, std::size_t size) {
|
||||
return ox_memset(ptr, val, size);
|
||||
}
|
||||
|
11
deps/ox/src/ox/std/memops.hpp
vendored
11
deps/ox/src/ox/std/memops.hpp
vendored
@ -17,6 +17,8 @@ extern "C" {
|
||||
|
||||
void *memcpy(void *dest, const void *src, std::size_t size);
|
||||
|
||||
void *memmove(void *dest, const void *src, std::size_t size);
|
||||
|
||||
void *memset(void *ptr, int val, std::size_t size);
|
||||
|
||||
}
|
||||
@ -33,6 +35,15 @@ constexpr void *ox_memcpy(void *dest, const void *src, std::size_t size) noexcep
|
||||
return dest;
|
||||
}
|
||||
|
||||
constexpr void *ox_memmove(void *dest, const void *src, std::size_t size) noexcept {
|
||||
auto srcBuf = static_cast<const char*>(src);
|
||||
auto dstBuf = static_cast<char*>(dest);
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
dstBuf[i] = static_cast<char>(srcBuf[i]);
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
constexpr void *ox_memset(void *ptr, int val, std::size_t size) noexcept {
|
||||
auto buf = static_cast<uint8_t*>(ptr);
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user