Skip to content

Commit

Permalink
Switched back to a for loop instead of a memcpy.
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Aug 1, 2018
1 parent 5f9b8b8 commit 19e0f98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/annoylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,15 @@ template<typename S, typename T, typename Distance, typename Random>
_allocate_size(item + 1);
Node* n = _get(item);

D::zero_value(n);

n->children[0] = 0;
n->children[1] = 0;
n->n_descendants = 1;

memcpy(n->v, w, _f * sizeof(T));
for (int z = 0; z < _f; z++)
n->v[z] = w[z];

D::init_node(n, _f);

if (item >= _n_items)
Expand Down

0 comments on commit 19e0f98

Please sign in to comment.