[ox/std] Add ox_inhibit_loop_to_libcall for memset and memcpy
This commit is contained in:
parent
ddb158e433
commit
e470a1da09
8
deps/ox/src/ox/std/memops.cpp
vendored
8
deps/ox/src/ox/std/memops.cpp
vendored
@ -11,18 +11,22 @@
|
||||
|
||||
#ifndef OX_USE_STDLIB
|
||||
|
||||
#define ox_inhibit_loop_to_libcall __attribute__((__optimize__ ("-fno-tree-loop-distribute-patterns")))
|
||||
|
||||
extern "C" {
|
||||
|
||||
void *memcpy(void *dest, const void *src, std::size_t size) {
|
||||
void *ox_inhibit_loop_to_libcall memcpy(void *dest, const void *src, std::size_t size) {
|
||||
return ox_memcpy(dest, src, size);
|
||||
}
|
||||
|
||||
void *memset(void *ptr, int val, std::size_t size) {
|
||||
void *ox_inhibit_loop_to_libcall memset(void *ptr, int val, std::size_t size) {
|
||||
return ox_memset(ptr, val, size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#undef ox_inhibit_loop_to_libcall
|
||||
|
||||
#endif
|
||||
|
||||
int ox_memcmp(const void *ptr1, const void *ptr2, std::size_t size) noexcept {
|
||||
|
4
deps/ox/src/ox/std/memops.hpp
vendored
4
deps/ox/src/ox/std/memops.hpp
vendored
@ -28,9 +28,9 @@ constexpr void *ox_memcpy(void *dest, const void *src, std::size_t size) noexcep
|
||||
}
|
||||
|
||||
constexpr void *ox_memset(void *ptr, int val, std::size_t size) noexcept {
|
||||
auto buf = static_cast<char*>(ptr);
|
||||
auto buf = reinterpret_cast<uint8_t*>(ptr);
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
buf[i] = val;
|
||||
buf[i] = static_cast<uint8_t>(val);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user