Correct bug related to signedness (M-HT).
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4198
This commit is contained in:
parent
94113a7362
commit
c9c97f13af
1 changed files with 3 additions and 3 deletions
|
@ -41,17 +41,17 @@ static inline bool diffYUV(Bit32u yuv1, Bit32u yuv2)
|
|||
Bit32u mask;
|
||||
|
||||
diff = ((yuv1 & Ymask) - (yuv2 & Ymask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
mask = ((Bit32s)diff) >> 31; // ~1/-1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trY) return true;
|
||||
|
||||
diff = ((yuv1 & Umask) - (yuv2 & Umask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
mask = ((Bit32s)diff)>> 31; // ~1/-1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trU) return true;
|
||||
|
||||
diff = ((yuv1 & Vmask) - (yuv2 & Vmask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
mask = ((Bit32s)diff) >> 31; // ~1/-1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trV) return true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue