From cca23e636354dc73429a19e14e32cc9a5e632735 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sat, 8 Nov 2014 20:05:12 +0100 Subject: Reduce required page alignment to 32 Since we no longer have a name/value pair in nodes we need one less bit to represent allocated flags. This reduces the page overhead by 32 bytes. --- src/pugixml.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/pugixml.cpp') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index e92ae60..f0efa90 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -407,13 +407,19 @@ PUGI__NS_BEGIN #endif ; - static const uintptr_t xml_memory_page_alignment = 64; + static const uintptr_t xml_memory_page_alignment = 32; static const uintptr_t xml_memory_page_pointer_mask = ~(xml_memory_page_alignment - 1); - static const uintptr_t xml_memory_page_contents_shared_mask = 32; - static const uintptr_t xml_memory_page_contents_allocated_mask = 16; - static const uintptr_t xml_memory_page_name_allocated_mask = 16; - static const uintptr_t xml_memory_page_value_allocated_mask = 8; + + // extra metadata bits for xml_node_struct + static const uintptr_t xml_memory_page_contents_shared_mask = 16; + static const uintptr_t xml_memory_page_contents_allocated_mask = 8; static const uintptr_t xml_memory_page_type_mask = 7; + + // extra metadata bits for xml_attribute_struct + static const uintptr_t xml_memory_page_name_allocated_mask = 2; + static const uintptr_t xml_memory_page_value_allocated_mask = 1; + + // combined masks for string uniqueness static const uintptr_t xml_memory_page_name_allocated_or_shared_mask = xml_memory_page_name_allocated_mask | xml_memory_page_contents_shared_mask; static const uintptr_t xml_memory_page_value_allocated_or_shared_mask = xml_memory_page_value_allocated_mask | xml_memory_page_contents_shared_mask; static const uintptr_t xml_memory_page_contents_allocated_or_shared_mask = xml_memory_page_contents_allocated_mask | xml_memory_page_contents_shared_mask; -- cgit v1.2.3