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

Frediano Ziglio fziglio at redhat.com
Wed Jan 27 08:09:49 PST 2016


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;
-- 
2.4.3



More information about the Spice-devel mailing list