-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guard some truncating casts with & 0xFF
The result of adding two unsigned chars is an int, so assigning this again to unsigned char results in a narrowing cast. Afaik this is well-defined by the standard but code compiled with cl with all runtime checks enabled will trigger a breakpoint when e.g. scanline[i] + recon[i - bytewidth] yields a number > 255. Fix this, and make it clear what's happening, by and'ing with 0xFF (which should be discarded by any sane optimizer anyway).
- Loading branch information
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters