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:
parent
e8fdd1303c
commit
bd7a8fa4bf
@ -7267,14 +7267,18 @@ PUGI__NS_BEGIN
|
|||||||
#endif
|
#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
|
struct xpath_memory_block
|
||||||
{
|
{
|
||||||
xpath_memory_block* next;
|
xpath_memory_block* next;
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
|
|
||||||
char data[xpath_memory_page_size];
|
union
|
||||||
|
{
|
||||||
|
char data[xpath_memory_page_size];
|
||||||
|
double alignment;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class xpath_allocator
|
class xpath_allocator
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user