mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-21 01:55:15 +08:00
Replace modulus with mask operation in over-aligned new
2016-09-16 Jonathan Wakely <jwakely@redhat.com> Marc Glisse <marc.glisse@inria.fr> * libsupc++/new_opa.cc [_GLIBCXX_HAVE_ALIGNED_ALLOC] (operator new(size_t, align_val_t)): Replace modulus operator with mask. Co-Authored-By: Marc Glisse <marc.glisse@inria.fr> From-SVN: r240192
This commit is contained in:
parent
8d987deb5b
commit
84c08ec96a
@ -1,3 +1,10 @@
|
||||
2016-09-16 Jonathan Wakely <jwakely@redhat.com>
|
||||
Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* libsupc++/new_opa.cc [_GLIBCXX_HAVE_ALIGNED_ALLOC]
|
||||
(operator new(size_t, align_val_t)): Replace modulus operator with
|
||||
mask.
|
||||
|
||||
2016-09-16 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* libsupc++/new_opa.cc [_GLIBCXX_HAVE_POSIX_MEMALIGN] (aligned_alloc):
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user