提交 0606c36a 编写于 作者: A Andreas Gruenbacher 提交者: Junio C Hamano

base85: Make the code more obvious instead of explaining the non-obvious

Here is another cleanup ...
Signed-off-by: NAndreas Gruenbacher <agruen@suse.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b0bec518
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册