From d2fe9bb5a20851e74cc0cd1f5123f9a63de9dd1e Mon Sep 17 00:00:00 2001 From: Victor Forsiuk Date: Mon, 2 Jun 2025 00:20:26 +0300 Subject: [PATCH] Update the single-header QOI format implementation code in our source tree from upstream --- src/imageio/qoi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imageio/qoi.h b/src/imageio/qoi.h index f2800b0ccbf4..e09d3a43dc3c 100644 --- a/src/imageio/qoi.h +++ b/src/imageio/qoi.h @@ -427,7 +427,7 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) { run = 0; } - index_pos = QOI_COLOR_HASH(px) % 64; + index_pos = QOI_COLOR_HASH(px) & (64 - 1); if (index[index_pos].v == px.v) { bytes[p++] = QOI_OP_INDEX | index_pos; @@ -574,7 +574,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) { run = (b1 & 0x3f); } - index[QOI_COLOR_HASH(px) % 64] = px; + index[QOI_COLOR_HASH(px) & (64 - 1)] = px; } pixels[px_pos + 0] = px.rgba.r;