allocator alignment

v1
Brett 2024-03-07 08:06:42 -05:00
parent a71adc328e
commit 8e3fc713e4
1 changed files with 14 additions and 12 deletions

View File

@ -17,19 +17,21 @@
*/ */
#ifndef BLT_ALLOCATOR_H #ifndef BLT_ALLOCATOR_H
#include <optional> #include <optional>
#include <limits> #include <limits>
#include <vector> #include <vector>
#include <blt/std/utility.h> #include <blt/std/utility.h>
#include <blt/std/types.h> #include <blt/std/types.h>
#include <blt/compatibility.h> #include <blt/compatibility.h>
#include <stdexcept> #include <stdexcept>
#include "logging.h" #include "logging.h"
#include <cstdlib> #include <cstdlib>
#ifdef __unix__ #ifdef __unix__
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
namespace blt namespace blt
@ -580,7 +582,7 @@ namespace blt
T* allocate_back() T* allocate_back()
{ {
size_t remaining_bytes = BLOCK_SIZE - static_cast<size_t>(head->metadata.offset - head->buffer); size_t remaining_bytes = BLOCK_SIZE - static_cast<size_t>(head->metadata.offset - head->buffer);
// auto& back = blocks.back(); // auto& back = blocks.back();
// size_t remaining_bytes = size_ - static_cast<size_t>(back.offset - back.buffer); // size_t remaining_bytes = size_ - static_cast<size_t>(back.offset - back.buffer);
// auto pointer = static_cast<void*>(back.offset); // auto pointer = static_cast<void*>(back.offset);