mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
minor tweaks in the overflow checking for VC++
This commit is contained in:
@@ -216,7 +216,13 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 data[],
|
|||||||
sum += qlp_coeff[j] * (*(--history));
|
sum += qlp_coeff[j] * (*(--history));
|
||||||
#ifdef FLAC__OVERFLOW_DETECT
|
#ifdef FLAC__OVERFLOW_DETECT
|
||||||
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
|
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
|
||||||
if(sumo > 2147483647ll || sumo < -2147483648ll) {
|
#ifdef _MSC_VER /* don't know how to do 64-bit literals in VC++ */
|
||||||
|
if(sumo < 0) sumo = -sumo;
|
||||||
|
if(sumo > 2147483647)
|
||||||
|
#else
|
||||||
|
if(sumo > 2147483647ll || sumo < -2147483648ll)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
|
fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -261,7 +267,13 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c
|
|||||||
sum += qlp_coeff[j] * (*(--history));
|
sum += qlp_coeff[j] * (*(--history));
|
||||||
#ifdef FLAC__OVERFLOW_DETECT
|
#ifdef FLAC__OVERFLOW_DETECT
|
||||||
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
|
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
|
||||||
if(sumo > 2147483647ll || sumo < -2147483648ll) {
|
#ifdef _MSC_VER /* don't know how to do 64-bit literals in VC++ */
|
||||||
|
if(sumo < 0) sumo = -sumo;
|
||||||
|
if(sumo > 2147483647)
|
||||||
|
#else
|
||||||
|
if(sumo > 2147483647ll || sumo < -2147483648ll)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
|
fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user