diff --git a/masstree_iterator.hh b/masstree_iterator.hh index 4b60208..3f1cb8e 100644 --- a/masstree_iterator.hh +++ b/masstree_iterator.hh @@ -50,6 +50,10 @@ class basic_table

::iterator ikey_type x[(MASSTREE_MAXKEYLEN + sizeof(ikey_type) - 1)/sizeof(ikey_type)]; char s[MASSTREE_MAXKEYLEN]; } keybuf_; + union { + ikey_type x[(MASSTREE_MAXKEYLEN + sizeof(ikey_type) - 1)/sizeof(ikey_type)]; + char s[MASSTREE_MAXKEYLEN]; + } keybuf2_; void advance(bool emit_equal = false); @@ -98,7 +102,10 @@ basic_table

::iterator::advance(bool emit_equal) { Str suffix; char suffixbuf[MASSTREE_MAXKEYLEN]; + memcpy(keybuf2_.s, keybuf_.s, sizeof(keybuf_)); + retry_root: + memcpy(keybuf_.s, keybuf2_.s, sizeof(keybuf2_)); ka_.unshift_all(); root = table_->root(); n = root->reach_leaf(ka_, v, *ti_);