Date: Mon, 30 May 2011 22:45:43 -0500 fast-import keeps tree structures for reuse in pools arranged by size: one for trees with 0 entries, one for 8-entry trees, one for 16-entry trees, and so on up to 784-entry trees, plus another pool for larger trees. Use the DIV_ROUND_UP macro to determine which pool a given-sized tree belongs in to avoid some confusing bit-twiddling. Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- Thanks for reading. fast-import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fast-import.c b/fast-import.c index ebb27006..fc1b549d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -785,7 +785,7 @@ static struct branch *new_branch(const char *name) static unsigned int hc_entries(unsigned int cnt) { - cnt = cnt & 7 ? (cnt / 8) + 1 : cnt / 8; + cnt = DIV_ROUND_UP(cnt, 8); return cnt < avail_tree_table_sz ? cnt : avail_tree_table_sz - 1; } @@ -805,7 +805,7 @@ static struct tree_content *new_tree_content(unsigned int cnt) else avail_tree_table[hc] = f->next_avail; } else { - cnt = cnt & 7 ? ((cnt / 8) + 1) * 8 : cnt; + cnt = DIV_ROUND_UP(cnt, 8) * 8; f = pool_alloc(sizeof(*t) + sizeof(t->entries[0]) * cnt); f->entry_capacity = cnt; } -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html