dlbeer / quirc

QR decoder library
Other
865 stars 285 forks source link

More quirc_float_t #141

Open zougloub opened 4 months ago

zougloub commented 4 months ago

I was checking out what's new and noticed @igrr 's float customization work, but also noticed that it was missing the static casting of constants, which at least GCC is missing (perhaps it could optimize with -ffast-math).

I also took the liberty of changing repetitive divisions by the same value, to use of the reciprocal of the value.

I validated that there were no more unwanted double stuff on my x86 station as well as with:

make \
 CC="arm-none-eabi-gcc" \
 CFLAGS="-DQUIRC_USE_TGMATH -D QUIRC_FLOAT_TYPE=float -mthumb -Os"

In this configuration, these changes are shaving off a whopping 51 bytes from the code size!

Note: This contribution was minimally tested and unreviewed.