mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-25 20:00:06 +01:00
ffs: handle 0 argument (bug #8968)
Handle an argument of 0 in ffs(), instead of looping indefinitely.
Add an ffs prototype to dix.h, and add includes to ffs.c.
(cherry picked from 34164e551e4c3909322d50b09835ca4ac1d49d68 commit)
(cherry picked from acb5ff4c73 commit)
This commit is contained in:
parent
9348662cc8
commit
69508dd98b
2 changed files with 5 additions and 0 deletions
|
|
@ -30,6 +30,8 @@ int
|
|||
ffs(int i)
|
||||
{
|
||||
int j;
|
||||
if (i == 0)
|
||||
return 0;
|
||||
for (j = 1; (i & 1) == 0; j++)
|
||||
i >>= 1;
|
||||
return j;
|
||||
|
|
|
|||
|
|
@ -815,4 +815,7 @@ typedef struct {
|
|||
extern int xstrcasecmp(char *s1, char *s2);
|
||||
#endif
|
||||
|
||||
/* ffs.c */
|
||||
extern int ffs(int i);
|
||||
|
||||
#endif /* DIX_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue