1
0
mirror of https://github.com/lz4/lz4.git synced 2026-10-24 01:48:57 +03:00

5 Commits

Author SHA1 Message Date
Alb3e3
72852fcea2 examples: cast division denominators to double
The macOS CI job builds the examples with

    CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" make test

and clang's -Wconversion implies -Wimplicit-int-float-conversion.  In each of
these ratio expressions the numerator is cast explicitly but the denominator is
left to convert implicitly, so newer clang rejects them:

    frameCompress.c:446:40: error: implicit conversion from
        'const unsigned long long' to 'double' may lose precision
        [-Werror,-Wimplicit-int-float-conversion]
      446 |             (double)ret.size_out / ret.size_in * 100);
          |                                  ~ ~~~~^~~~~~~

Cast the denominators too, matching how fileCompress.c:193 already writes the
same computation.  The conversion happened anyway via the usual arithmetic
conversions, so the printed values are unchanged.

frameCompress.c is only the first failure; make stops there, and
bench_functions.c has ten more instances of the same pattern behind it.
2026-10-07 14:47:53 -07:00
Yann Collet
6bdfc56c9a fix minor conversion warnings on macos 2023-12-22 20:11:12 -08:00
Yann Collet
8586d6a1b2 fix example for low resolution timers 2023-09-26 12:56:56 -07:00
Yann Collet
65d3772592 fix minor c++ compat warning 2023-09-26 12:56:56 -07:00
Yann Collet
67532ae3c5 fix examples
streamlined Makefile.
avoid usage of -lrt (problematic for portability).
now bench_functions (renamed) can be part of `make test`.

fix #1276
2023-09-26 12:56:56 -07:00