From a85d958e4a773ace6983f5bcd53d915d7c48f9b6 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 19 Sep 2017 22:03:23 -0700 Subject: [PATCH] fix wrong mask in alignment calculation --- src/util/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/memory.h b/src/util/memory.h index 45127e2..67479cb 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -66,7 +66,7 @@ struct Aligned_memory_allocator_base Base_pointer base = new unsigned char[size]; auto alignment_start = reinterpret_cast(base + sizeof(Base_pointer)); auto retval = - reinterpret_cast((alignment_start + Alignment - 1) & (Alignment - 1)); + reinterpret_cast((alignment_start + Alignment - 1) & ~(Alignment - 1)); auto base_location = reinterpret_cast(retval) - 1; *base_location = base; return retval; -- 2.30.2