libroot: Adjust malloc_hoard2 to use max_align_t when available.
Spotted while investigating #18111, but likely does not fix it. This matches the existing behavior of the runtime_loader heap.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#define _HEAP_H_
|
#define _HEAP_H_
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -75,10 +76,10 @@ class hoardHeap {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Every object is aligned so that it can always hold any type.
|
// Every object is aligned so that it can always hold any type.
|
||||||
#ifdef __x86_64__
|
#if __cplusplus >= 201103L
|
||||||
enum { ALIGNMENT = 16 };
|
enum { ALIGNMENT = alignof(max_align_t) };
|
||||||
#else
|
#else
|
||||||
enum { ALIGNMENT = sizeof(double) };
|
enum { ALIGNMENT = 8 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ANDing with this rounds to ALIGNMENT.
|
// ANDing with this rounds to ALIGNMENT.
|
||||||
|
|||||||
Reference in New Issue
Block a user