XWin: Fix infinite loop in GetShift()
GetShift(int mask) can be called with mask==0, causing it to go into an infinite loop. Note: GetShift(mask) will return 0 for a mask of both 0 and -1. The assumption is that if mask == 0, then the corresponding bits for which we're calculating the shift, are also 0.
This commit is contained in:
parent
0c729bb958
commit
71c3a97142
|
@ -1597,8 +1597,7 @@ static int
|
|||
GetShift(int mask)
|
||||
{
|
||||
int shift = 0;
|
||||
|
||||
while ((mask &1) == 0) {
|
||||
while (mask > 1) {
|
||||
shift++;
|
||||
mask >>=1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user