aboutsummaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:23 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:23 -0700
commitf056cde60e7b095edf1530554a8c9528bd8b374b (patch)
tree1507f5729cc2a2718b59712b0aac3a7350c2144f /sha1_name.c
parent768d0fe0dadbffe722fa4b80b2180a4fcaf1c854 (diff)
parent42c78a216e751cfa2720c8276c9e9f2b81640e6b (diff)
downloadgit-f056cde60e7b095edf1530554a8c9528bd8b374b.tar.gz
git-f056cde60e7b095edf1530554a8c9528bd8b374b.tar.xz
Merge branch 'rs/use-div-round-up'
Code cleanup. * rs/use-div-round-up: use DIV_ROUND_UP
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sha1_name.c b/sha1_name.c
index e7f7b12ce..74fcb6d78 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -489,10 +489,9 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)
* We now know we have on the order of 2^len objects, which
* expects a collision at 2^(len/2). But we also care about hex
* chars, not bits, and there are 4 bits per hex. So all
- * together we need to divide by 2; but we also want to round
- * odd numbers up, hence adding one before dividing.
+ * together we need to divide by 2 and round up.
*/
- len = (len + 1) / 2;
+ len = DIV_ROUND_UP(len, 2);
/*
* For very small repos, we stick with our regular fallback.
*/