Cast to unsigned to avoid sign-extension problems.

This commit is contained in:
Dag-Erling Smørgrav 2004-01-13 16:02:20 +00:00
parent 1de30b60cb
commit 8746a69a28
4 changed files with 4 additions and 4 deletions

View File

@ -47,6 +47,6 @@ ffs(int mask)
if (mask == 0)
return (0);
for (bit = 1; !(mask & 1); bit++)
mask >>= 1;
(unsigned int)mask >>= 1;
return (bit);
}

View File

@ -47,6 +47,6 @@ ffsl(long mask)
if (mask == 0)
return (0);
for (bit = 1; !(mask & 1); bit++)
mask >>= 1;
(unsigned long)mask >>= 1;
return (bit);
}

View File

@ -47,6 +47,6 @@ fls(int mask)
if (mask == 0)
return (0);
for (bit = 1; mask != 1; bit++)
mask >>= 1;
(unsigned int)mask >>= 1;
return (bit);
}

View File

@ -47,6 +47,6 @@ flsl(long mask)
if (mask == 0)
return (0);
for (bit = 1; mask != 1; bit++)
mask >>= 1;
(unsigned long)mask >>= 1;
return (bit);
}