Chromium Code Reviews| Index: base/lazy_instance.h |
| diff --git a/base/lazy_instance.h b/base/lazy_instance.h |
| index 1183806bef5565ed9a142b1c26cc94e68de0ded0..66efd481425af0ddc8ea551496d881ddb0b508de 100644 |
| --- a/base/lazy_instance.h |
| +++ b/base/lazy_instance.h |
| @@ -60,10 +60,10 @@ struct DefaultLazyInstanceTraits { |
| #endif |
| static Type* New(void* instance) { |
| - DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (ALIGNOF(Type) - 1), 0u) |
| - << ": Bad boy, the buffer passed to placement new is not aligned!\n" |
| - "This may break some stuff like SSE-based optimizations assuming the " |
| - "<Type> objects are word aligned."; |
| + DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (alignof(Type) - 1), 0u) |
|
jbroman
2017/02/08 18:21:34
I'm not sure why this isn't just reinterpret_cast<
|
| + << "The buffer passed to placement new is not aligned!\n" |
| + "This may break some stuff like SSE-based optimizations assuming " |
| + "the <Type> objects are word aligned."; |
| // Use placement new to initialize our instance in our preallocated space. |
| // The parenthesis is very important here to force POD type initialization. |
| return new (instance) Type(); |
| @@ -184,7 +184,7 @@ class LazyInstance { |
| subtle::AtomicWord private_instance_; |
| // Preallocated space for the Type instance. |
| - base::AlignedMemory<sizeof(Type), ALIGNOF(Type)> private_buf_; |
| + base::AlignedMemory<sizeof(Type), alignof(Type)> private_buf_; |
| private: |
| Type* instance() { |