[Spice-devel] [PATCH 4/5] Avoid to call ceil_log_2 twice with same value

Jonathon Jongsma jjongsma at redhat.com
Wed Jan 27 09:43:47 PST 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

On Wed, 2016-01-27 at 16:09 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  common/quic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/quic.c b/common/quic.c
> index 0e6c948..a32a530 100644
> --- a/common/quic.c
> +++ b/common/quic.c
> @@ -394,9 +394,9 @@ static void family_init(QuicFamily *family, int bpc, int
> limit)
>          altcodewords = bppmask[bpc] + 1 - (altprefixlen << l);
>  
>          family->nGRcodewords[l] = (altprefixlen << l);
> -        family->notGRcwlen[l] = altprefixlen + ceil_log_2(altcodewords);
> -        family->notGRprefixmask[l] = bppmask[32 - altprefixlen]; /* needed
> for decoding only */
>          family->notGRsuffixlen[l] = ceil_log_2(altcodewords); /* needed for
> decoding only */
> +        family->notGRcwlen[l] = altprefixlen + family->notGRsuffixlen[l];
> +        family->notGRprefixmask[l] = bppmask[32 - altprefixlen]; /* needed
> for decoding only */
>  
>          for (b = 0; b < 256; b++) {
>              unsigned int code, len;


More information about the Spice-devel mailing list