diff options
Diffstat (limited to 'third_party/abseil-cpp/absl/random/internal/pool_urbg.cc')
-rw-r--r-- | third_party/abseil-cpp/absl/random/internal/pool_urbg.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc b/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc index 5bee530770..725100a415 100644 --- a/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +++ b/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc @@ -194,11 +194,10 @@ RandenPoolEntry* PoolAlignedAlloc() { // Not all the platforms that we build for have std::aligned_alloc, however // since we never free these objects, we can over allocate and munge the // pointers to the correct alignment. - void* memory = std::malloc(sizeof(RandenPoolEntry) + kAlignment); - auto x = reinterpret_cast<intptr_t>(memory); + intptr_t x = reinterpret_cast<intptr_t>( + new char[sizeof(RandenPoolEntry) + kAlignment]); auto y = x % kAlignment; - void* aligned = - (y == 0) ? memory : reinterpret_cast<void*>(x + kAlignment - y); + void* aligned = reinterpret_cast<void*>(y == 0 ? x : (x + kAlignment - y)); return new (aligned) RandenPoolEntry(); } |