shithub: libsamplerate

Download patch

ref: b200f95bd88d8dd170f401c3b6b41bae8a925008
parent: eaaab36fd4dc95f88876df8905c106724e82f822
author: sezero <sezero@users.sourceforge.net>
date: Thu Nov 12 07:37:02 EST 2020

src_sinc.c: change SHIFT_BITS sanity check into compile time assert

--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -38,6 +38,7 @@
 
 typedef int32_t increment_t ;
 typedef float	coeff_t ;
+typedef int _CHECK_SHIFT_BITS[2 * (SHIFT_BITS < sizeof (increment_t) * 8 - 1) - 1]; /* sanity check. */
 
 #include "fastest_coeffs.h"
 #include "mid_qual_coeffs.h"
@@ -251,13 +252,6 @@
 		converter_type == SRC_SINC_BEST_QUALITY) ;
 	assert (channels > 0) ;
 	assert (error != NULL) ;
-
-	/* Quick sanity check. */
-	if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1)
-	{
-		*error = SRC_ERR_SHIFT_BITS ;
-		return NULL ;
-	}
 
 	if (channels > MAX_CHANNELS)
 	{