XPath: Increase memory block alignment to 8 bytes

To be more precise, the memory block is now aligned to be able to reliably
allocate objects with both double and pointer fields. If there is a platform
with a 4-byte double and a 4-byte pointer, the memory block alignment there will
stay the same after this change.

Fixes #48.
This commit is contained in:
Arseny Kapoulkine 2015-07-25 17:08:19 -04:00
parent e8fdd1303c
commit bd7a8fa4bf

View file

@ -7267,14 +7267,18 @@ PUGI__NS_BEGIN
#endif
;
static const uintptr_t xpath_memory_block_alignment = sizeof(void*);
static const uintptr_t xpath_memory_block_alignment = sizeof(double) > sizeof(void*) ? sizeof(double) : sizeof(void*);
struct xpath_memory_block
{
xpath_memory_block* next;
size_t capacity;
char data[xpath_memory_page_size];
union
{
char data[xpath_memory_page_size];
double alignment;
};
};
class xpath_allocator