### Calculate Data Section Offset Source: https://maxmind.github.io/MaxMind-DB Use this formula to calculate the offset within the data section when a record value points to data. The value is relative to the start of the data section. ```plaintext $data_section_offset = ( $record_value - $node_count ) - 16 ``` -------------------------------- ### Simplified File Offset Calculation Source: https://maxmind.github.io/MaxMind-DB A simplified formula to directly calculate the file offset from the record value, node count, and search tree size. ```plaintext $offset_in_file = ( $record_value - $node_count ) + $search_tree_size_in_bytes ``` -------------------------------- ### 24-bit Node Record Layout Source: https://maxmind.github.io/MaxMind-DB Layout for small databases where one node is 6 bytes total. ```text | <------------- node --------------->| | 23 .. 0 | 23 .. 0 | ``` -------------------------------- ### 32-bit Node Record Layout Source: https://maxmind.github.io/MaxMind-DB Layout for large databases where one node is 8 bytes total. ```text | <------------- node --------------->| | 31 .. 0 | 31 .. 0 | ``` -------------------------------- ### 28-bit Node Record Layout Source: https://maxmind.github.io/MaxMind-DB Layout for medium databases where one node is 7 bytes total. Four bits of each pointer are combined into the middle byte. ```text | <------------- node --------------->| | 23 .. 0 | 27..24 | 27..24 | 23 .. 0 | ``` -------------------------------- ### Calculate File Offset from Data Section Offset Source: https://maxmind.github.io/MaxMind-DB This formula determines the actual offset in the file by adding the search tree size and data section separator to the data section offset. ```plaintext $offset_in_file = $data_section_offset + $search_tree_size_in_bytes + 16 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.