History

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

sezero committed 6 years ago

Commit b200f951 parent eaaab361 file · +1 −7Browse files

Unified · Split

src/src_sinc.c+1−7
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838
3939 typedef int32_t increment_t ;
4040 typedef float coeff_t ;
41+typedef int _CHECK_SHIFT_BITS[2 * (SHIFT_BITS < sizeof (increment_t) * 8 - 1) - 1]; /* sanity check. */
4142
4243 #include "fastest_coeffs.h"
4344 #include "mid_qual_coeffs.h"
@@ -252,13 +253,6 @@ sinc_state_new (int converter_type, int channels, SRC_ERROR *error) · 208 unmodified lines
252253 assert (channels > 0) ;
253254 assert (error != NULL) ;
254255
255− /* Quick sanity check. */
256− if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1)
257− {
258− *error = SRC_ERR_SHIFT_BITS ;
259− return NULL ;
260− }
261−
262256 if (channels > MAX_CHANNELS)
263257 {
264258 *error = SRC_ERR_BAD_CHANNEL_COUNT ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t