summaryrefslogtreecommitdiff
path: root/base85.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-01-08 14:40:00 +0100
committerJunio C Hamano <gitster@pobox.com>2010-01-09 22:43:47 -0800
commit0606c36a73449e76d8f6133253c1eff291ee8c97 (patch)
tree2ec75efa7aff370eecab0acaaf0431855b83b4b3 /base85.c
parentb0bec518aa4a90485c411cebc7260425271af949 (diff)
downloadgit-0606c36a73449e76d8f6133253c1eff291ee8c97.tar.gz
base85: Make the code more obvious instead of explaining the non-obvious
Here is another cleanup ... Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'base85.c')
-rw-r--r--base85.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/base85.c b/base85.c
index f2b9a24d5e..24ddf60eb0 100644
--- a/base85.c
+++ b/base85.c
@@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len)
de = de85[ch];
if (--de < 0)
return error("invalid base85 alphabet %c", ch);
- /*
- * Detect overflow. The largest
- * 5-letter possible is "|NsC0" to
- * encode 0xffffffff, and "|NsC" gives
- * 0x03030303 at this point (i.e.
- * 0xffffffff = 0x03030303 * 85).
- */
- if (0x03030303 < acc ||
+ /* Detect overflow. */
+ if (0xffffffff / 85 < acc ||
0xffffffff - de < (acc *= 85))
return error("invalid base85 sequence %.5s", buffer-5);
acc += de;