[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] base64: provide a fast path for encoding well sized buffers
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] base64: provide a fast path for encoding well sized buffers |
Date: |
Mon, 11 Nov 2013 16:10:58 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 11/11/2013 04:07 PM, Pádraig Brady wrote:
> --- a/lib/base64.c
> +++ b/lib/base64.c
> - while (inlen && outlen)
> + /* Note the outlen constraint can be enforced at compile time,
> + while the inlen can change at runtime at the end of input.
> + But the common case when reading large inputs is to have
> + both constraints satisfied, so we depend on both in
> + base_encode_fast(). */
> + if ((inlen % 3 == 0) && BASE64_LENGTH (inlen) == outlen)
> + return base64_encode_fast (in, inlen, out);
> +
> + while (inlen)
Oops that should be inlen && outlen