Skip to content

Commit bf34bc1

Browse files
committed
[build] Add support for ASM files in Make + CMake
* Extract out common portion of `lib/Makefile` into `lib/libzstd.mk`. Most relevantly, the way we find library files. * Use `lib/libzstd.mk` in the other Makefiles instead of repeating the same code. * Add a test `tests/test-variants.sh` that checks that the builds of `make -C programs allVariants` are correct, and run it in Actions. * Adds support for ASM files in the CMake build. The Meson build is not updated because it lists every file in zstd, and supports ASM off the bat, so the Huffman ASM commit will just add the ASM file to the list. The Visual Studios build is not updated because I'm not adding ASM support to Visual Studios yet.
1 parent 9d2a45a commit bf34bc1

File tree

14 files changed

+442
-324
lines changed

14 files changed

+442
-324
lines changed

.github/workflows/dev-short-tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ jobs:
200200
make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
201201
make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
202202
203+
test-variants:
204+
runs-on: ubuntu-latest
205+
steps:
206+
- uses: actions/checkout@v2
207+
- name: make all variants & validate
208+
run: |
209+
make -j -C programs allVariants MOREFLAGS=-O0
210+
./tests/test-variants.sh
211+
203212
204213
qemu-consistency:
205214
name: QEMU ${{ matrix.name }}
@@ -263,7 +272,6 @@ jobs:
263272
run: |
264273
LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
265274
266-
267275
# This test currently fails on Github Actions specifically.
268276
# Possible reason : TTY emulation.
269277
# Note that the same test works fine locally and on travisCI.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ armbuild: clean
217217
CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
218218

219219
aarch64build: clean
220-
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
220+
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd
221221

222222
ppcbuild: clean
223223
CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd

build/cmake/lib/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# in the COPYING file in the root directory of this source tree).
88
# ################################################################
99

10-
project(libzstd C)
10+
project(libzstd C ASM)
1111

1212
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
1313
option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
@@ -22,7 +22,7 @@ include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common)
2222

2323
file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c)
2424
file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c)
25-
file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c)
25+
file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S)
2626
file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c)
2727

2828
set(Sources

contrib/freestanding_lib/freestanding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ def _log(self, *args, **kwargs):
460460
print(*args, **kwargs)
461461

462462
def _copy_file(self, lib_path):
463-
if not (lib_path.endswith(".c") or lib_path.endswith(".h")):
463+
suffixes = [".c", ".h", ".S"]
464+
if not any((lib_path.endswith(suffix) for suffix in suffixes)):
464465
return
465466
if lib_path in SKIPPED_FILES:
466467
self._log(f"\tSkipping file: {lib_path}")

contrib/linux-kernel/test/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE
1818
LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c)
1919
LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c)
2020
LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c)
21-
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c)
21+
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c $(LINUX_ZSTDLIB)/decompress/*.S)
2222
LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS)
23-
LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o)
23+
LINUX_ZSTD_OBJECTS0 := $(LINUX_ZSTD_FILES:.c=.o)
24+
LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_OBJECTS0:.S=.o)
25+
26+
%.o: %.S
27+
$(CC) -c $(CPPFLAGS) $(CFLAGS) $^ -o $@
2428

2529
liblinuxzstd.a: $(LINUX_ZSTD_OBJECTS)
2630
$(AR) $(ARFLAGS) $@ $^

contrib/pzstd/Makefile

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -pthread -o $@
5757
CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@
5858
CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
5959

60-
# Get a list of all zstd files so we rebuild the static library when we need to
61-
ZSTDCOMMON_FILES := $(wildcard $(ZSTDDIR)/common/*.c) \
62-
$(wildcard $(ZSTDDIR)/common/*.h)
63-
ZSTDCOMP_FILES := $(wildcard $(ZSTDDIR)/compress/*.c) \
64-
$(wildcard $(ZSTDDIR)/compress/*.h)
65-
ZSTDDECOMP_FILES := $(wildcard $(ZSTDDIR)/decompress/*.c) \
66-
$(wildcard $(ZSTDDIR)/decompress/*.h)
67-
ZSTDPROG_FILES := $(wildcard $(PROGDIR)/*.c) \
68-
$(wildcard $(PROGDIR)/*.h)
69-
ZSTD_FILES := $(wildcard $(ZSTDDIR)/*.h) \
70-
$(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \
71-
$(ZSTDPROG_FILES)
72-
7360
# List all the pzstd source files so we can determine their dependencies
7461
PZSTD_SRCS := $(wildcard *.cpp)
7562
PZSTD_TESTS := $(wildcard test/*.cpp)
@@ -189,7 +176,8 @@ roundtrip: test/RoundTripTest$(EXT)
189176

190177
# Use the static library that zstd builds for simplicity and
191178
# so we get the compiler options correct
192-
$(ZSTDDIR)/libzstd.a: $(ZSTD_FILES)
179+
.PHONY: $(ZSTDDIR)/libzstd.a
180+
$(ZSTDDIR)/libzstd.a:
193181
CFLAGS="$(ALL_CFLAGS)" LDFLAGS="$(ALL_LDFLAGS)" $(MAKE) -C $(ZSTDDIR) libzstd.a
194182

195183
# Rules to build the tests

lib/Makefile

Lines changed: 38 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -8,110 +8,13 @@
88
# You may select, at your option, one of the above-listed licenses.
99
# ################################################################
1010

11-
# Note: by default, the static library is built single-threaded and dynamic library is built
12-
# multi-threaded. It is possible to force multi or single threaded builds by appending
13-
# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded).
14-
.PHONY: default
15-
default: lib-release
16-
17-
# define silent mode as default (verbose mode with V=1 or VERBOSE=1)
18-
$(V)$(VERBOSE).SILENT:
19-
20-
# When cross-compiling from linux to windows,
21-
# one might need to specify TARGET_SYSTEM as "Windows."
22-
# Building from Fedora fails without it.
23-
# (but Ubuntu and Debian don't need to set anything)
24-
TARGET_SYSTEM ?= $(OS)
25-
26-
# Version numbers
27-
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
28-
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
29-
LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
30-
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
31-
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
32-
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
33-
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
34-
LIBVER := $(shell echo $(LIBVER_SCRIPT))
35-
VERSION?= $(LIBVER)
36-
CCVER := $(shell $(CC) --version)
37-
38-
# ZSTD_LIB_MINIFY is a helper variable that
39-
# configures a bunch of other variables to space-optimized defaults.
40-
ZSTD_LIB_MINIFY ?= 0
41-
ifneq ($(ZSTD_LIB_MINIFY), 0)
42-
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
43-
ZSTD_LEGACY_SUPPORT ?= 0
44-
ZSTD_LIB_DEPRECATED ?= 0
45-
HUF_FORCE_DECOMPRESS_X1 ?= 1
46-
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1
47-
ZSTD_NO_INLINE ?= 1
48-
ZSTD_STRIP_ERROR_STRINGS ?= 1
49-
ifneq ($(HAVE_CC_OZ), 0)
50-
# Some compilers (clang) support an even more space-optimized setting.
51-
CFLAGS += -Oz
52-
else
53-
CFLAGS += -Os
54-
endif
55-
CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
56-
-DDYNAMIC_BMI2=0 -DNDEBUG
57-
else
58-
CFLAGS += -O3
59-
endif
60-
61-
DEBUGLEVEL ?= 0
62-
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL)
63-
ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
64-
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
65-
endif
66-
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
67-
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
68-
-Wstrict-prototypes -Wundef -Wpointer-arith \
69-
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
70-
-Wredundant-decls -Wmissing-prototypes -Wc++-compat
71-
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
72-
FLAGS = $(CPPFLAGS) $(CFLAGS)
73-
74-
CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded
75-
LDFLAGS_DYNLIB = -pthread
76-
CPPFLAGS_STATLIB = # static library build defaults to single-threaded
77-
78-
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
79-
GREP_OPTIONS ?=
80-
ifeq ($HAVE_COLORNEVER, 1)
81-
GREP_OPTIONS += --color=never
82-
endif
83-
GREP = grep $(GREP_OPTIONS)
84-
SED_ERE_OPT ?= -E
85-
86-
ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c))
87-
ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c))
88-
ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c))
89-
ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c))
90-
ZDEPR_FILES := $(sort $(wildcard deprecated/*.c))
91-
ZSTD_FILES := $(ZSTDCOMMON_FILES)
92-
93-
ifeq ($(findstring GCC,$(CCVER)),GCC)
94-
decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize
95-
endif
96-
9711
# Modules
9812
ZSTD_LIB_COMPRESSION ?= 1
9913
ZSTD_LIB_DECOMPRESSION ?= 1
10014
ZSTD_LIB_DICTBUILDER ?= 1
10115
ZSTD_LIB_DEPRECATED ?= 0
10216

103-
# Legacy support
104-
ZSTD_LEGACY_SUPPORT ?= 5
105-
ZSTD_LEGACY_MULTITHREADED_API ?= 0
106-
107-
# Build size optimizations
108-
HUF_FORCE_DECOMPRESS_X1 ?= 0
109-
HUF_FORCE_DECOMPRESS_X2 ?= 0
110-
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0
111-
ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0
112-
ZSTD_NO_INLINE ?= 0
113-
ZSTD_STRIP_ERROR_STRINGS ?= 0
114-
17+
# Input variables for libzstd.mk
11518
ifeq ($(ZSTD_LIB_COMPRESSION), 0)
11619
ZSTD_LIB_DICTBUILDER = 0
11720
ZSTD_LIB_DEPRECATED = 0
@@ -122,86 +25,46 @@ ifeq ($(ZSTD_LIB_DECOMPRESSION), 0)
12225
ZSTD_LIB_DEPRECATED = 0
12326
endif
12427

28+
include libzstd.mk
29+
30+
ZSTD_FILES := $(ZSTD_COMMON_FILES) $(ZSTD_LEGACY_FILES)
31+
12532
ifneq ($(ZSTD_LIB_COMPRESSION), 0)
126-
ZSTD_FILES += $(ZSTDCOMP_FILES)
33+
ZSTD_FILES += $(ZSTD_COMPRESS_FILES)
12734
endif
12835

12936
ifneq ($(ZSTD_LIB_DECOMPRESSION), 0)
130-
ZSTD_FILES += $(ZSTDDECOMP_FILES)
37+
ZSTD_FILES += $(ZSTD_DECOMPRESS_FILES)
13138
endif
13239

13340
ifneq ($(ZSTD_LIB_DEPRECATED), 0)
134-
ZSTD_FILES += $(ZDEPR_FILES)
41+
ZSTD_FILES += $(ZSTD_DEPRECATED_FILES)
13542
endif
13643

13744
ifneq ($(ZSTD_LIB_DICTBUILDER), 0)
138-
ZSTD_FILES += $(ZDICT_FILES)
139-
endif
140-
141-
ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0)
142-
CFLAGS += -DHUF_FORCE_DECOMPRESS_X1
143-
endif
144-
145-
ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0)
146-
CFLAGS += -DHUF_FORCE_DECOMPRESS_X2
147-
endif
148-
149-
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0)
150-
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
151-
endif
152-
153-
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0)
154-
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
155-
endif
156-
157-
ifneq ($(ZSTD_NO_INLINE), 0)
158-
CFLAGS += -DZSTD_NO_INLINE
45+
ZSTD_FILES += $(ZSTD_DICTBUILDER_FILES)
15946
endif
16047

161-
ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0)
162-
CFLAGS += -DZSTD_STRIP_ERROR_STRINGS
163-
endif
164-
165-
ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0)
166-
CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API
167-
endif
168-
169-
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
170-
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
171-
ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
172-
endif
173-
endif
174-
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
175-
17648
ZSTD_LOCAL_SRC := $(notdir $(ZSTD_FILES))
177-
ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_SRC:.c=.o)
49+
ZSTD_LOCAL_OBJ0 := $(ZSTD_LOCAL_SRC:.c=.o)
50+
ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_OBJ0:.S=.o)
17851

179-
ZSTD_SUBDIR := common compress decompress dictBuilder legacy deprecated
180-
vpath %.c $(ZSTD_SUBDIR)
52+
VERSION := $(ZSTD_VERSION)
18153

182-
UNAME := $(shell uname)
54+
# Note: by default, the static library is built single-threaded and dynamic library is built
55+
# multi-threaded. It is possible to force multi or single threaded builds by appending
56+
# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded).
57+
.PHONY: default
58+
default: lib-release
59+
60+
CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded
61+
LDFLAGS_DYNLIB = -pthread
62+
CPPFLAGS_STATLIB = # static library build defaults to single-threaded
18363

184-
ifndef BUILD_DIR
185-
ifeq ($(UNAME), Darwin)
186-
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
187-
HASH ?= md5
188-
endif
189-
else ifeq ($(UNAME), FreeBSD)
190-
HASH ?= gmd5sum
191-
else ifeq ($(UNAME), NetBSD)
192-
HASH ?= md5 -n
193-
else ifeq ($(UNAME), OpenBSD)
194-
HASH ?= md5
195-
endif
196-
HASH ?= md5sum
19764

198-
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " )
199-
HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
200-
ifeq ($(HAVE_HASH),0)
201-
$(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
202-
BUILD_DIR := obj/generic_noconf
65+
ifeq ($(findstring GCC,$(CCVER)),GCC)
66+
decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize
20367
endif
204-
endif # BUILD_DIR
20568

20669

20770
# macOS linker doesn't support -soname, and use different extension
@@ -218,13 +81,6 @@ else
21881
SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)
21982
endif
22083

221-
SET_CACHE_DIRECTORY = \
222-
+$(MAKE) --no-print-directory $@ \
223-
BUILD_DIR=obj/$(HASH_DIR) \
224-
CPPFLAGS="$(CPPFLAGS)" \
225-
CFLAGS="$(CFLAGS)" \
226-
LDFLAGS="$(LDFLAGS)"
227-
22884

22985
.PHONY: all
23086
all: lib
@@ -233,6 +89,13 @@ all: lib
23389
.PHONY: libzstd.a # must be run every time
23490
libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB)
23591

92+
SET_CACHE_DIRECTORY = \
93+
+$(MAKE) --no-print-directory $@ \
94+
BUILD_DIR=obj/$(HASH_DIR) \
95+
CPPFLAGS="$(CPPFLAGS)" \
96+
CFLAGS="$(CFLAGS)" \
97+
LDFLAGS="$(LDFLAGS)"
98+
23699
ifndef BUILD_DIR
237100
# determine BUILD_DIR from compilation flags
238101

@@ -343,6 +206,14 @@ $(ZSTD_STATLIB_DIR)/%.o : %.c $(ZSTD_STATLIB_DIR)/%.d | $(ZSTD_STATLIB_DIR)
343206
@echo CC $@
344207
$(COMPILE.c) $(DEPFLAGS) $(ZSTD_STATLIB_DIR)/$*.d $(OUTPUT_OPTION) $<
345208

209+
$(ZSTD_DYNLIB_DIR)/%.o : %.S | $(ZSTD_DYNLIB_DIR)
210+
@echo AS $@
211+
$(COMPILE.c) $(OUTPUT_OPTION) $<
212+
213+
$(ZSTD_STATLIB_DIR)/%.o : %.S | $(ZSTD_STATLIB_DIR)
214+
@echo AS $@
215+
$(COMPILE.c) $(OUTPUT_OPTION) $<
216+
346217
MKDIR ?= mkdir
347218
$(BUILD_DIR) $(ZSTD_DYNLIB_DIR) $(ZSTD_STATLIB_DIR):
348219
$(MKDIR) -p $@

lib/compress/huf_compress.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ typedef struct {
445445
/* RANK_POSITION_DISTINCT_COUNT_CUTOFF == Cutoff point in HUF_sort() buckets for which we use log2 bucketing.
446446
* Strategy is to use as many buckets as possible for representing distinct
447447
* counts while using the remainder to represent all "large" counts.
448-
*
448+
*
449449
* To satisfy this requirement for 192 buckets, we can do the following:
450450
* Let buckets 0-166 represent distinct counts of [0, 166]
451451
* Let buckets 166 to 192 represent all remaining counts up to RANK_POSITION_MAX_COUNT_LOG using log2 bucketing.
@@ -517,7 +517,7 @@ static int HUF_quickSortPartition(nodeElt arr[], int const low, int const high)
517517
}
518518

519519
/* Classic quicksort by descending with partially iterative calls
520-
* to reduce worst case callstack size.
520+
* to reduce worst case callstack size.
521521
*/
522522
static void HUF_simpleQuickSort(nodeElt arr[], int low, int high) {
523523
int const kInsertionSortThreshold = 8;
@@ -813,6 +813,7 @@ FORCE_INLINE_TEMPLATE void HUF_addBits(HUF_CStream_t* bitC, HUF_CElt elt, int id
813813
assert(((elt >> dirtyBits) << (dirtyBits + nbBits)) == 0);
814814
/* We didn't overwrite any bits in the bit container. */
815815
assert(!kFast || (bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER);
816+
(void)dirtyBits;
816817
}
817818
#endif
818819
}

0 commit comments

Comments
 (0)