From c77929bb8a5c53b7a9f030a213fac54a1cff1d8f Mon Sep 17 00:00:00 2001 From: ndenoyelle Date: Thu, 24 Jan 2019 08:57:50 -0600 Subject: [PATCH] fix order bug --- src/tleaf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tleaf.c b/src/tleaf.c index 6dca841..6755581 100644 --- a/src/tleaf.c +++ b/src/tleaf.c @@ -116,7 +116,8 @@ static ssize_t tleaf_it_value(struct tleaf_it_s *it) ssize_t i, acc = 1, val = 0; for (i = 0; i < it->depth; i++) { - val += acc * it->buf[it->order[it->depth - i - 1]]; + /* levels are stacked following order, then decode result backward order_inverse */ + val += acc * it->buf[it->order_inverse[it->depth - i - 1]]; acc *= it->arities[it->depth - i - 1]; } return val; -- 2.26.2