mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
feat(memory): add additional operator overloads
This commit is contained in:
parent
f46c0c2c4c
commit
768a535eea
1 changed files with 20 additions and 0 deletions
|
|
@ -8,22 +8,42 @@ void* operator new(size_t bytes) {
|
|||
return SMemAlloc(bytes, "new", -1, 0x0);
|
||||
}
|
||||
|
||||
void* operator new(size_t bytes, const std::nothrow_t&) noexcept {
|
||||
return SMemAlloc(bytes, "new(nothrow_t)", -1, 0x0);
|
||||
}
|
||||
|
||||
void* operator new[](size_t bytes) {
|
||||
return SMemAlloc(bytes, "new[]", -1, 0x0);
|
||||
}
|
||||
|
||||
void* operator new[](size_t bytes, const std::nothrow_t&) noexcept {
|
||||
return SMemAlloc(bytes, "new[](nothrow_t)", -1, 0x0);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr) noexcept {
|
||||
if (ptr) {
|
||||
SMemFree(ptr, "delete", -1, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept {
|
||||
if (ptr) {
|
||||
SMemFree(ptr, "delete(nothrow_t)", -1, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr) noexcept {
|
||||
if (ptr) {
|
||||
SMemFree(ptr, "delete[]", -1, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept {
|
||||
if (ptr) {
|
||||
SMemFree(ptr, "delete[](nothrow_t)", -1, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
void* STORMAPI SMemAlloc(size_t bytes, const char* filename, int32_t linenumber, uint32_t flags) {
|
||||
size_t alignedBytes = (bytes + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue