From b7b245a7b0d60bb10e6d65d063da1098222198a9 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Mon, 4 Aug 2025 00:43:02 +0300 Subject: [PATCH] Formatting --- third_party/host_memory/virtual_buffer.cpp | 53 +++++++++++----------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/third_party/host_memory/virtual_buffer.cpp b/third_party/host_memory/virtual_buffer.cpp index 66fdc44a..b6575796 100644 --- a/third_party/host_memory/virtual_buffer.cpp +++ b/third_party/host_memory/virtual_buffer.cpp @@ -10,38 +10,37 @@ #include "host_memory/virtual_buffer.h" namespace Common { - -void* AllocateMemoryPages(std::size_t size) noexcept { + void* AllocateMemoryPages(std::size_t size) noexcept { #ifdef _WIN32 - void* base{VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_READWRITE)}; + void* base{VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_READWRITE)}; #else - void* base{mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0)}; + void* base{mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0)}; - if (base == MAP_FAILED) { - base = nullptr; - } + if (base == MAP_FAILED) { + base = nullptr; + } #endif - if (!base) { - Helpers::panic("Failed to allocate memory pages"); - } + if (!base) { + Helpers::panic("Failed to allocate memory pages"); + } - return base; -} - -void FreeMemoryPages(void* base, [[maybe_unused]] std::size_t size) noexcept { - if (!base) { - return; - } -#ifdef _WIN32 - if (!VirtualFree(base, 0, MEM_RELEASE)) { - Helpers::panic("Failed to free memory pages"); + return base; } -#else - if (munmap(base, size) != 0) { - Helpers::panic("Failed to free memory pages"); - } -#endif -} -} // namespace Common \ No newline at end of file + void FreeMemoryPages(void* base, [[maybe_unused]] std::size_t size) noexcept { + if (!base) { + return; + } +#ifdef _WIN32 + if (!VirtualFree(base, 0, MEM_RELEASE)) { + Helpers::panic("Failed to free memory pages"); + } +#else + if (munmap(base, size) != 0) { + Helpers::panic("Failed to free memory pages"); + } +#endif + } + +} // namespace Common \ No newline at end of file