From de8034929755c47084aef85577fd92eb5ebb9181 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Wed, 1 May 2024 17:03:19 +0200 Subject: [PATCH] Fix bug in CHECK_ORDER_IS_VALID macro in functions with intrinsics (#696) This fixes a few things I missed with https://github.com/xiph/flac/pull/694 --- src/libFLAC/fixed_intrin_avx2.c | 2 +- src/libFLAC/fixed_intrin_sse42.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libFLAC/fixed_intrin_avx2.c b/src/libFLAC/fixed_intrin_avx2.c index 85fc4a6d04..8522aef5ef 100644 --- a/src/libFLAC/fixed_intrin_avx2.c +++ b/src/libFLAC/fixed_intrin_avx2.c @@ -178,7 +178,7 @@ if(shadow_error_##macro_order <= INT32_MAX) { \ order = macro_order; \ smallest_error = total_error_##macro_order ; \ } \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f; diff --git a/src/libFLAC/fixed_intrin_sse42.c b/src/libFLAC/fixed_intrin_sse42.c index 0556eaaddb..4fddf91f46 100644 --- a/src/libFLAC/fixed_intrin_sse42.c +++ b/src/libFLAC/fixed_intrin_sse42.c @@ -59,7 +59,7 @@ if(shadow_error_##macro_order <= INT32_MAX) { \ order = macro_order; \ smallest_error = total_error_##macro_order ; \ } \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f;