Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with internal_node_key() #91

Open
zhou-zheng opened this issue Nov 22, 2022 · 0 comments
Open

Bug with internal_node_key() #91

zhou-zheng opened this issue Nov 22, 2022 · 0 comments

Comments

@zhou-zheng
Copy link

Hi, there! Great work! But I found a bug:

uint32_t *internal_node_key(void *node, uint32_t key_num)
{
    return internal_node_cell(node, key_num) + INTERNAL_NODE_CHILD_SIZE;
}

should be

uint32_t *internal_node_key(void *node, uint32_t key_num)
{
    return internal_node_cell(node, key_num) + INTERNAL_NODE_CHILD_SIZE/sizeof(uint32_t);
}

Otherwise, the position of max key would get a 12 bytes offset compared to Internal Node Header Layout because the internal_node_cell() returns a uint32_t pointer, which means, when we plus INTERNAL_NODE_CHILD_SIZE(4 bytes) to it, it would be 4*4 =16bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant