From: Jacob Lifshay Date: Wed, 20 Sep 2017 05:03:23 +0000 (-0700) Subject: fix wrong mask in alignment calculation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a85d958e4a773ace6983f5bcd53d915d7c48f9b6;p=kazan.git fix wrong mask in alignment calculation --- 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;