mirror of
https://gitlab.com/ecodis/exhale.git
synced 2025-01-21 11:25:47 +01:00
fix undefined behavior: unaligned read
Casting a type pointer into a larger type pointer requires alignment. This replaces the unportable code with a portable equivalent.
This commit is contained in:
parent
5cc33e5af7
commit
ac021570a3
@ -275,10 +275,18 @@ static inline void applyTnsCoeffPreProcessing (LinearPredictor& predictor, TnsDa
|
|||||||
if (commonFlag != nullptr) *commonFlag &= (tnsData1.coeffResLow[n] == tnsData2.coeffResLow[n] && tnsData1.filterOrder[n] == tnsData2.filterOrder[n]);
|
if (commonFlag != nullptr) *commonFlag &= (tnsData1.coeffResLow[n] == tnsData2.coeffResLow[n] && tnsData1.filterOrder[n] == tnsData2.filterOrder[n]);
|
||||||
if (commonFlag != nullptr && *commonFlag)
|
if (commonFlag != nullptr && *commonFlag)
|
||||||
{
|
{
|
||||||
const int32_t* coeff1 = (int32_t*) tnsData1.coeff[n]; // fast
|
const int32_t coeff1 = (int32_t)
|
||||||
const int32_t* coeff2 = (int32_t*) tnsData2.coeff[n]; // comp
|
((uint32_t) tnsData1.coeff[n][0]) |
|
||||||
|
((uint32_t) tnsData1.coeff[n][1] << 8) |
|
||||||
|
((uint32_t) tnsData1.coeff[n][2] << 16) |
|
||||||
|
((uint32_t) tnsData1.coeff[n][3] << 24);
|
||||||
|
const int32_t coeff2 = (int32_t)
|
||||||
|
((uint32_t) tnsData2.coeff[n][0]) |
|
||||||
|
((uint32_t) tnsData2.coeff[n][1] << 8) |
|
||||||
|
((uint32_t) tnsData2.coeff[n][2] << 16) |
|
||||||
|
((uint32_t) tnsData2.coeff[n][3] << 24);
|
||||||
|
|
||||||
*commonFlag &= (*coeff1 == *coeff2); // might not be portable!
|
*commonFlag &= (coeff1 == coeff2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user