commit 0a70fa595953ff1e6e46266d7f86bc6d7e3400a4 Author: Jonathan Wakely Date: Fri Sep 16 17:36:44 2016 +0100 Replace modulus with mask operation in over-aligned new 2016-09-16 Jonathan Wakely Marc Glisse * libsupc++/new_opa.cc [_GLIBCXX_HAVE_ALIGNED_ALLOC] (operator new(size_t, align_val_t)): Replace modulus operator with mask. diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc index 9c859c1..91e53a8 100644 --- a/libstdc++-v3/libsupc++/new_opa.cc +++ b/libstdc++-v3/libsupc++/new_opa.cc @@ -69,7 +69,7 @@ operator new (std::size_t sz, std::align_val_t al) #if _GLIBCXX_HAVE_ALIGNED_ALLOC /* C11: the value of size shall be an integral multiple of alignment. */ - if (std::size_t rem = sz % align) + if (std::size_t rem = sz & (align - 1)) sz += align - rem; #endif