提交 d60d718c 编写于 作者: R Reimar Döffinger

Slightly optimize base64 encode.

Move handling of last byte outside of innermost loop.
Signed-off-by: NReimar Döffinger <Reimar.Doeffinger@gmx.de>
上级 6af4c981
...@@ -93,8 +93,10 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size) ...@@ -93,8 +93,10 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
do { do {
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f]; *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
i_shift -= 6; i_shift -= 6;
} while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0)); } while (i_shift > 6);
} }
if (i_shift > 0)
*dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
while ((dst - ret) & 3) while ((dst - ret) & 3)
*dst++ = '='; *dst++ = '=';
*dst = '\0'; *dst = '\0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册