[libcxx-commits] [PATCH] D138196: [libc++] Use aligned_alloc instead of posix_memalign for C++17

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 1 13:34:33 PST 2022


arichardson added inline comments.


================
Comment at: libcxx/include/new:350
+    // round __size up to the next multiple of __alignment.
+    size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
+    // Rounding up could have wrap around to zero, so we have add another
----------------
I'd hope these additional computations can be elided by the compiler in many cases - not sure how often the values are completely dynamic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138196/new/

https://reviews.llvm.org/D138196



More information about the libcxx-commits mailing list