]> wimlib.net Git - wimlib/blobdiff - src/lzms-compress.c
lzms-compress.c: Remove unused function
[wimlib] / src / lzms-compress.c
index fb1f777ac6b5c3adeb69c1a8bf7508e603baf92f..da1904fc9f66cf8927db8a08cc31176a7e9c4c51 100644 (file)
@@ -7,20 +7,18 @@
 /*
  * Copyright (C) 2013, 2014 Eric Biggers
  *
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
  *
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option)
- * any later version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -349,15 +347,6 @@ lzms_output_bitstream_put_varbits(struct lzms_output_bitstream *os,
        }
 }
 
-/* Use when @num_bits is a compile-time constant.  Otherwise use
- * lzms_output_bitstream_put_bits().  */
-static inline void
-lzms_output_bitstream_put_bits(struct lzms_output_bitstream *os,
-                              u32 bits, unsigned num_bits)
-{
-       lzms_output_bitstream_put_varbits(os, bits, num_bits, num_bits);
-}
-
 /* Flush the output bitstream, ensuring that all bits written to it have been
  * written to memory.  Returns %true if all bits have been output successfully,
  * or %false if an overrun occurred.  */
@@ -716,7 +705,7 @@ lzms_do_init_rc_costs(void)
                for (u32 j = 0; j < LZMS_COST_SHIFT; j++) {
                        w *= w;
                        bit_count <<= 1;
-                       while (w >= (1U << 16)) {
+                       while (w >= ((u32)1 << 16)) {
                                w >>= 1;
                                ++bit_count;
                        }
@@ -888,8 +877,7 @@ lzms_consider_lz_explicit_offset_matches(const struct lzms_compressor *c,
        len = 2;
        i = 0;
        do {
-               position_cost = base_cost + lzms_lz_offset_cost(c,
-                                                               matches[i].offset);
+               position_cost = base_cost + lzms_lz_offset_cost(c, matches[i].offset);
                do {
                        cost = position_cost + lzms_fast_length_cost(c, len);
                        if (cost < (cur_optimum_ptr + len)->cost) {
@@ -1218,8 +1206,8 @@ begin:
                 *      the parser will not go too long without updating the
                 *      probability tables.
                 *
-                * Note: no check for end-of-block is needed because
-                * end-of-block will trigger condition (1).
+                * Note: no check for end-of-window is needed because
+                * end-of-window will trigger condition (1).
                 */
                if (cur_optimum_ptr == end_optimum_ptr ||
                    cur_optimum_ptr == c->optimum_end)
@@ -1376,26 +1364,26 @@ lzms_finalize(struct lzms_compressor *c, u8 *cdata, size_t csize_avail)
  * maximum window size.  */
 static void
 lzms_build_params(unsigned int compression_level,
-                 struct lzms_compressor_params *lzms_params)
+                 struct lzms_compressor_params *params)
 {
        /* Allow length 2 matches if the compression level is sufficiently high.
         */
        if (compression_level >= 45)
-               lzms_params->min_match_length = 2;
+               params->min_match_length = 2;
        else
-               lzms_params->min_match_length = 3;
+               params->min_match_length = 3;
 
        /* Scale nice_match_length and max_search_depth with the compression
         * level.  But to allow an optimization on length cost calculations,
         * don't allow nice_match_length to exceed LZMS_NUM_FAST_LENGTH.  */
-       lzms_params->nice_match_length = ((u64)compression_level * 32) / 50;
-       if (lzms_params->nice_match_length < lzms_params->min_match_length)
-               lzms_params->nice_match_length = lzms_params->min_match_length;
-       if (lzms_params->nice_match_length > LZMS_NUM_FAST_LENGTHS)
-               lzms_params->nice_match_length = LZMS_NUM_FAST_LENGTHS;
-       lzms_params->max_search_depth = compression_level;
-
-       lzms_params->optim_array_length = 1024;
+       params->nice_match_length = ((u64)compression_level * 32) / 50;
+       if (params->nice_match_length < params->min_match_length)
+               params->nice_match_length = params->min_match_length;
+       if (params->nice_match_length > LZMS_NUM_FAST_LENGTHS)
+               params->nice_match_length = LZMS_NUM_FAST_LENGTHS;
+       params->max_search_depth = compression_level;
+
+       params->optim_array_length = 1024;
 }
 
 /* Given the internal compression parameters and maximum window size, build the