d3d8: Adjust D3DCOLOR_ARGB to avoid shift overflow.
gerald at pfeifer.com
Fri Oct 16 16:02:24 CDT 2015
On Mon, 14 Sep 2015, Stefan Dösinger wrote:
> Am 2015-09-13 um 22:56 schrieb Gerald Pfeifer:
>> -#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
>> +#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xffu)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
> Wouldn't it make sense to make the masks for the other channels unsigned
We could make all unsigned. The problem here only is with the first
since the <<24 may lead to an overflow of signed, but you have a good
point that consistency may be better.
I'll submit a patch shortly.
> Are there any possible side effects when compiling code with winelib?
> The native header uses a signed 0xff.
I can't think of one, since the & and | operators are bitwise, as is
Thanks for the feedback, and sorry for the slow response now.
More information about the wine-devel