From 8bfe7ee6f3fa89482a09d3c6ea933759f4d4b4a7 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Thu, 25 Mar 2021 15:06:52 +0800 Subject: [PATCH] [btree] Fix rebalancing checks --- persistent-data/data-structures/btree.tcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistent-data/data-structures/btree.tcc b/persistent-data/data-structures/btree.tcc index 059ebaa..27c9adc 100644 --- a/persistent-data/data-structures/btree.tcc +++ b/persistent-data/data-structures/btree.tcc @@ -338,7 +338,7 @@ namespace persistent_data { unsigned nr_right = rhs.get_nr_entries(); unsigned max_entries = get_max_entries(); - if (nr_left - count > max_entries || nr_right - count > max_entries) + if (nr_left - count > max_entries || nr_right + count > max_entries) throw runtime_error("too many entries"); if (count > 0) {