mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-02-13 02:44:21 +01:00
Address undefined warnings from compilers for left shifting negative integers in zpaq.
Some checks are pending
check_build / build (push) Waiting to run
Some checks are pending
check_build / build (push) Waiting to run
This commit is contained in:
parent
1ea9a2b3ed
commit
843fa4168a
|
|
@ -801,7 +801,11 @@ void Predictor::init() {
|
|||
cr.cm.resize(512);
|
||||
for (int j=0; j<256; ++j) {
|
||||
cr.cm[j*2]=1<<15;
|
||||
cr.cm[j*2+1]=clamp512k(stretch(st.cminit(j)>>8)<<10);
|
||||
// Left shift of negative values is undefined strictly speaking so
|
||||
// cast it back and forth to safely perform left shift and avoid
|
||||
// compiler issues. Original code:
|
||||
// cr.cm[j*2+1]=clamp512k(stretch(st.cminit(j)>>8)<<10);
|
||||
cr.cm[j*2+1]=clamp512k(static_cast<int>(static_cast<unsigned int>(stretch(st.cminit(j) >> 8)) << 10));
|
||||
}
|
||||
break;
|
||||
case SSE: // sizebits j start limit
|
||||
|
|
|
|||
Loading…
Reference in a new issue