From c53da8a06f305b4fe2ab28b1dfc7f35a4a5e98d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Afonso=20Janu=C3=A1rio?= Date: Mon, 7 Sep 2026 10:55:28 +0100 Subject: [PATCH] Use powf instead of pow when building the gamma LUT All the values going into this call are float, but pow() pulls in the double-precision exp/log tables anyway, which costs almost 10KB of extra binary size on some platforms for no benefit. Switched to powf() so it stays on the float LUTs the rest of the file already uses. Checked the resulting gamma_lut entries against the old code across a wide range of gamma values and they come out identical. --- spng/spng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spng/spng.c b/spng/spng.c index b22b711..cb3e928 100644 --- a/spng/spng.c +++ b/spng/spng.c @@ -3803,7 +3803,7 @@ int spng_decode_image(spng_ctx *ctx, void *out, size_t len, int fmt, int flags) unsigned i; for(i=0; i < lut_entries; i++) { - float c = pow((float)i / max, exponent) * max; + float c = powf((float)i / max, exponent) * max; if(c > max) c = max; gamma_lut[i] = (uint16_t)c;