From 2fcc8369db0914e452c8cef093ea90b1c84f3d2b Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 16 Jul 2024 03:17:18 -0400 Subject: [PATCH] broken --- CMakeLists.txt | 2 +- include/blt/gp/program.h | 2 +- include/blt/gp/stack.h | 3 ++- include/blt/gp/tree.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ea7bf4..93a7578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(blt-gp VERSION 0.0.84) +project(blt-gp VERSION 0.0.85) include(CTest) diff --git a/include/blt/gp/program.h b/include/blt/gp/program.h index 6362f20..f6bdb7e 100644 --- a/include/blt/gp/program.h +++ b/include/blt/gp/program.h @@ -506,7 +506,7 @@ namespace blt::gp operator_storage storage; population_t current_pop; - population_stats current_stats; + population_stats current_stats {}; population_t next_pop; std::atomic_uint64_t current_generation = 0; diff --git a/include/blt/gp/stack.h b/include/blt/gp/stack.h index 90777fb..6d8225d 100644 --- a/include/blt/gp/stack.h +++ b/include/blt/gp/stack.h @@ -164,6 +164,7 @@ namespace blt::gp { using NO_REF_T = std::remove_cv_t>; static_assert(std::is_trivially_copyable_v && "Type must be bitwise copyable!"); + static_assert(alignof(NO_REF_T) <= MAX_ALIGNMENT && "Type must not be greater than the max alignment!"); auto ptr = allocate_bytes(); head->metadata.offset = static_cast(ptr) + aligned_size(); new(ptr) NO_REF_T(std::forward(value)); @@ -487,7 +488,7 @@ namespace blt::gp static block* allocate_block(blt::size_t bytes) { - auto size = to_nearest_page_size(bytes); + auto size = to_nearest_page_size(bytes + sizeof(typename block::block_metadata_t)); auto* data = std::aligned_alloc(PAGE_SIZE, size); //auto* data = get_allocator().allocate(size); new(data) block{size}; diff --git a/include/blt/gp/tree.h b/include/blt/gp/tree.h index 6fedd9f..72df3a6 100644 --- a/include/blt/gp/tree.h +++ b/include/blt/gp/tree.h @@ -152,7 +152,7 @@ namespace blt::gp std::atomic average_fitness = 0; std::atomic best_fitness = 0; std::atomic worst_fitness = 1; - std::vector normalized_fitness; + std::vector normalized_fitness{}; void clear() {