]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Add comments.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 14 Feb 2024 12:58:36 +0000 (14:58 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 14 Feb 2024 16:31:16 +0000 (18:31 +0200)
src/liblzma/lzma/lzma_decoder.c
src/liblzma/rangecoder/range_decoder.h

index 6c9cbe22d0fc54eb7f6162c088240b3a21c2b145..58045e11bcfcea6f99e8a7edbd619ff2dadd61e6 100644 (file)
@@ -474,6 +474,15 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
                                        // Variable number (1-5) of bits
                                        // from a reverse bittree. This
                                        // isn't worth manual unrolling.
+                                       //
+                                       // NOTE: Making one or many of the
+                                       // variables (probs, symbol, offset,
+                                       // or limit) local here (instead of
+                                       // using those declared outside the
+                                       // main loop) can affect code size
+                                       // and performance which isn't a
+                                       // surprise but it's not so clear
+                                       // what is the best.
                                        do {
                                                rc_bit_add_if_1(probs,
                                                                rep0, offset);
index ffec7bf27c961318e366cbef75b0e4da778619ed..ddac10609c05b339071026093ad42f914c2444d9 100644 (file)
@@ -305,8 +305,15 @@ do { \
 } while (0)
 
 
-// Decode one bit from variable-sized reverse bittree.
-// The loop is done in the code that uses this macro.
+// Decode one bit from variable-sized reverse bittree. The loop is done
+// in the code that uses this macro. This could be changed if the assembly
+// version benefited from having the loop done in assembly but it didn't
+// seem so in early 2024.
+//
+// Also, if the loop was done here, the loop counter would likely be local
+// to the macro so that it wouldn't modify yet another input variable.
+// If a _safe version of a macro with a loop was done then a modifiable
+// input variable couldn't be avoided though.
 #define rc_bit_add_if_1(probs, dest, value_to_add_if_1) \
        rc_bit(probs[symbol], \
                , \