Adjusted OC_DCT_CW_PACK() for well defined C99 behaviour with negative _mag.
Instead of shifting the negative number, shift one bit and multiply it with the negative number. Fixes the following clang message: ../../lib/decode.c:195:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0,10, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:198:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, 0,1), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:208:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 1, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:210:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 2, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:212:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 3, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:214:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 4, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:216:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 5, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:220:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 1, -2,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:221:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 1, -3,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:227:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 6, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:228:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 7, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:229:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 8, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:230:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 9, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:236:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 2, -2,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:237:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 3, -2,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:238:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 2, -3,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:239:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 3, -3,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:242:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, 0,1), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:253:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -1,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:257:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -2,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:260:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -3,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:262:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -4,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:264:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -5,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:266:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -6,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:270:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -7,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:271:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -8,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:277:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0, -9,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:278:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0,-10,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:279:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0,-11,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ ../../lib/decode.c:280:3: warning: shifting a negative signed value is undefined [-Wshift-negative-value] OC_DCT_CW_PACK( 0, 0,-12,0), ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/decode.c:150:16: note: expanded from macro 'OC_DCT_CW_PACK' (_mag)-(_flip)<<OC_DCT_CW_MAG_SHIFT) ~~~~~~~~~~~~~~^ Fixes #2322
Loading
Please register or sign in to comment