Skip to content

Commit

Permalink
[radix-tree] Fix bug in _degrade_to_n16
Browse files Browse the repository at this point in the history
Values were getting shuffled
  • Loading branch information
jthornber committed Sep 20, 2018
1 parent 0ac7913 commit ebd2d77
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions base/data-struct/radix-tree-adaptive.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,11 @@ static void _degrade_to_n16(struct node48 *n48, struct value *result)
for (i = 0; i < 256; i++) {
if (n48->keys[i] < 48) {
n16->keys[count] = i;
n16->values[count] = n48->values[n48->keys[i]];
count++;
}
}

memcpy(n16->values, n48->values, n48->nr_entries * sizeof(*n16->values));

free(n48);

result->type = NODE16;
Expand Down

0 comments on commit ebd2d77

Please sign in to comment.