Unified · Split
| @@ -148,7 +148,7 @@ sinc_get_description (int src_enum) · 147 unmodified lines | ||
| 148 | 148 | int |
| 149 | 149 | sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) |
| 150 | 150 | { SINC_FILTER *filter, temp_filter ; |
| 151 | − int count ; | |
| 151 | + int count, bits ; | |
| 152 | 152 | |
| 153 | 153 | /* Quick sanity check. */ |
| 154 | 154 | if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1) |
| @@ -217,9 +217,11 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 62 unmodified lines | ||
| 217 | 217 | |
| 218 | 218 | sinc_reset (psrc) ; |
| 219 | 219 | |
| 220 | − count = lrint ((filter->coeff_half_len * INT_TO_FP (1)) / FP_ONE) ; | |
| 220 | + count = filter->coeff_half_len ; | |
| 221 | + for (bits = 0 ; (1 << bits) < count ; bits++) | |
| 222 | + count |= (1 << bits) ; | |
| 221 | 223 | |
| 222 | − if (abs (count - filter->coeff_half_len) >= 1) | |
| 224 | + if (bits + SHIFT_BITS - 1 >= (int) (sizeof (increment_t) * 8)) | |
| 223 | 225 | return SRC_ERR_FILTER_LEN ; |
| 224 | 226 | |
| 225 | 227 | return SRC_ERR_NO_ERROR ; |