summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f630cfd)
raw | patch | inline | side by side (parent: f630cfd)
author | Pierre Habouzit <madcoder@debian.org> | |
Wed, 22 Jul 2009 21:34:35 +0000 (23:34 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 23 Jul 2009 04:57:41 +0000 (21:57 -0700) |
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h | patch | blob | history | |
help.c | patch | blob | history | |
preload-index.c | patch | blob | history |
diff --git a/git-compat-util.h b/git-compat-util.h
index 6dfc0ddd90ae6abc7863086f520a678c545850a5..9f941e42b16d927f738b4911b41344dd2f3ed0da 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (bitsizeof(x) - (bits))))
#define HAS_MULTI_BITS(i) ((i) & ((i) - 1)) /* checks if an integer has more than 1 bit set */
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+
/* Approximation of the length of the decimal representation of this type. */
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
index fd87bb5aeec82beec600be46248b19b13bb33804..6c46d8b4949c4ad70ca6abc7edb4f7926c889a5a 100644 (file)
--- a/help.c
+++ b/help.c
if (space < max_cols)
cols = max_cols / space;
- rows = (cmds->cnt + cols - 1) / cols;
+ rows = DIV_ROUND_UP(cmds->cnt, cols);
for (i = 0; i < rows; i++) {
printf(" ");
diff --git a/preload-index.c b/preload-index.c
index 14d52811832d8f2a3f6c1e1e5502c51ce73da82e..92899333c2d8edbed71fdd3a43e19f25a10e5b03 100644 (file)
--- a/preload-index.c
+++ b/preload-index.c
if (threads > MAX_PARALLEL)
threads = MAX_PARALLEL;
offset = 0;
- work = (index->cache_nr + threads - 1) / threads;
+ work = DIV_ROUND_UP(index->cache_nr, threads);
for (i = 0; i < threads; i++) {
struct thread_data *p = data+i;
p->index = index;