Skip to content

Commit 38cec87

Browse files
r-barnesradarhere
andauthored
Fix shift-sign issue in Convert.c (python-pillow#7838)
* Fix shift-sign issue in Convert.c Fixes ``` libImaging/Convert.c:513:25: error: signed shift result (0xFF000000) sets the sign bit of the shift expression's type ('int') and becomes negative [-Werror,-Wshift-sign-overflow] UINT32 trns = (0xff << 24) | ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff); ~~~~ ^ ~~ ``` --------- Co-authored-by: Andrew Murray <[email protected]>
1 parent 3f5721d commit 38cec87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libImaging/Convert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ rgbT2rgba(UINT8 *out, int xsize, int r, int g, int b) {
510510
UINT32 trns = ((r & 0xff) << 24) | ((g & 0xff) << 16) | ((b & 0xff) << 8) | 0xff;
511511
UINT32 repl = trns & 0xffffff00;
512512
#else
513-
UINT32 trns = (0xff << 24) | ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff);
513+
UINT32 trns = (0xffU << 24) | ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff);
514514
UINT32 repl = trns & 0x00ffffff;
515515
#endif
516516

0 commit comments

Comments
 (0)