Skip to content

Commit 0606c36

Browse files
Andreas Gruenbachergitster
authored andcommitted
base85: Make the code more obvious instead of explaining the non-obvious
Here is another cleanup ... Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0bec51 commit 0606c36

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

base85.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len)
5757
de = de85[ch];
5858
if (--de < 0)
5959
return error("invalid base85 alphabet %c", ch);
60-
/*
61-
* Detect overflow. The largest
62-
* 5-letter possible is "|NsC0" to
63-
* encode 0xffffffff, and "|NsC" gives
64-
* 0x03030303 at this point (i.e.
65-
* 0xffffffff = 0x03030303 * 85).
66-
*/
67-
if (0x03030303 < acc ||
60+
/* Detect overflow. */
61+
if (0xffffffff / 85 < acc ||
6862
0xffffffff - de < (acc *= 85))
6963
return error("invalid base85 sequence %.5s", buffer-5);
7064
acc += de;

0 commit comments

Comments
 (0)