feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -30,11 +30,10 @@
#include "memory.h"
#include "core/error/error_macros.h"
#include "core/templates/safe_refcount.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void *operator new(size_t p_size, const char *p_description) {
return Memory::alloc_static(p_size, false);
@ -65,6 +64,38 @@ SafeNumeric<uint64_t> Memory::max_usage;
SafeNumeric<uint64_t> Memory::alloc_count;
void *Memory::alloc_aligned_static(size_t p_bytes, size_t p_alignment) {
DEV_ASSERT(is_power_of_2(p_alignment));
void *p1, *p2;
if ((p1 = (void *)malloc(p_bytes + p_alignment - 1 + sizeof(uint32_t))) == nullptr) {
return nullptr;
}
p2 = (void *)(((uintptr_t)p1 + sizeof(uint32_t) + p_alignment - 1) & ~((p_alignment)-1));
*((uint32_t *)p2 - 1) = (uint32_t)((uintptr_t)p2 - (uintptr_t)p1);
return p2;
}
void *Memory::realloc_aligned_static(void *p_memory, size_t p_bytes, size_t p_prev_bytes, size_t p_alignment) {
if (p_memory == nullptr) {
return alloc_aligned_static(p_bytes, p_alignment);
}
void *ret = alloc_aligned_static(p_bytes, p_alignment);
if (ret) {
memcpy(ret, p_memory, p_prev_bytes);
}
free_aligned_static(p_memory);
return ret;
}
void Memory::free_aligned_static(void *p_memory) {
uint32_t offset = *((uint32_t *)p_memory - 1);
void *p = (void *)((uint8_t *)p_memory - offset);
free(p);
}
void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
#ifdef DEBUG_ENABLED
bool prepad = true;