diff --git a/CMakeLists.txt b/CMakeLists.txt index 6461d4f..aca07eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(blt-gp VERSION 0.0.17) +project(blt-gp VERSION 0.0.18) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/include/blt/gp/program.h b/include/blt/gp/program.h index f313d73..c3521ee 100644 --- a/include/blt/gp/program.h +++ b/include/blt/gp/program.h @@ -112,24 +112,18 @@ namespace blt::gp return offset; } - template - inline CurrentArgument& getArgument(stack_allocator& allocator) const - { - return allocator.from(getByteOffset()); - } - template inline Return sequence_to_indices(stack_allocator& allocator, std::integer_sequence) const { - return func(getArgument(allocator)...); + // expands Args and indices, providing each argument with its index calculating the current argument byte offset + return func(allocator.from(getByteOffset())...); } [[nodiscard]] inline Return operator()(stack_allocator& allocator) const { auto seq = std::make_integer_sequence(); Return ret = sequence_to_indices(allocator, seq); - constexpr auto total_bytes = (stack_allocator::aligned_size() + ...); - allocator.pop_bytes(total_bytes); + allocator.pop_bytes((stack_allocator::aligned_size() + ...)); return ret; }