From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/qoi/tests/common.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 vendor/qoi/tests/common.rs (limited to 'vendor/qoi/tests/common.rs') diff --git a/vendor/qoi/tests/common.rs b/vendor/qoi/tests/common.rs new file mode 100644 index 0000000..cc1eff1 --- /dev/null +++ b/vendor/qoi/tests/common.rs @@ -0,0 +1,12 @@ +#[allow(unused)] +pub fn hash(px: [u8; N]) -> u8 { + let r = px[0]; + let g = px[1]; + let b = px[2]; + let a = if N >= 4 { px[3] } else { 0xff }; + let rm = r.wrapping_mul(3); + let gm = g.wrapping_mul(5); + let bm = b.wrapping_mul(7); + let am = a.wrapping_mul(11); + rm.wrapping_add(gm).wrapping_add(bm).wrapping_add(am) % 64 +} -- cgit v1.2.3