- fix memory arena allocation alignment for 32 bit systems.

This commit is contained in:
Christoph Oelckers 2018-06-03 18:20:50 +02:00
parent a851a5d151
commit 23fce56b5e

View file

@ -55,13 +55,14 @@ struct FMemArena::Block
// //
// RoundPointer // RoundPointer
// //
// Rounds a pointer up to a pointer-sized boundary. // Rounds a pointer up to the size of the largest integral type.
// //
//========================================================================== //==========================================================================
static inline void *RoundPointer(void *ptr) static inline void *RoundPointer(void *ptr)
{ {
return (void *)(((size_t)ptr + sizeof(void*) - 1) & ~(sizeof(void*) - 1)); const auto roundsize = std::max(sizeof(void*), sizeof(double));
return (void *)(((size_t)ptr + roundsize - 1) & ~(roundsize - 1));
} }
//========================================================================== //==========================================================================