Commit 91925d70 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clarify use of and need for mffs vs. ffs

Backport of this xorg-xserver commit: commit 75c51c67b340548286efd41a53882e2acaf74ab5 Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Thu Jun 18 09:49:12 2009 -0700 Clarify use of and need for mffs vs. ffs Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@sun.com>
parent cf461c36
...@@ -106,6 +106,8 @@ static unsigned long startTimeInMillis; ...@@ -106,6 +106,8 @@ static unsigned long startTimeInMillis;
Windows in the code */ Windows in the code */
#define GetErrno() errno #define GetErrno() errno
/* like ffs, but uses fd_mask instead of int as argument, so it works
when fd_mask is longer than an int, such as common 64-bit platforms */
/* modifications by raphael */ /* modifications by raphael */
int int
mffs(fd_mask mask) mffs(fd_mask mask)
...@@ -480,7 +482,7 @@ WaitForSomething(int *pClientsReady) ...@@ -480,7 +482,7 @@ WaitForSomething(int *pClientsReady)
{ {
int client_index; int client_index;
curclient = ffs (clientsReadable.fds_bits[i]) - 1; curclient = mffs (clientsReadable.fds_bits[i]) - 1;
client_index = /* raphael: modified */ client_index = /* raphael: modified */
ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
pClientsReady[nready++] = client_index; pClientsReady[nready++] = client_index;
......
...@@ -908,7 +908,7 @@ CheckConnections(void) ...@@ -908,7 +908,7 @@ CheckConnections(void)
mask = AllClients.fds_bits[i]; mask = AllClients.fds_bits[i];
while (mask) while (mask)
{ {
curoff = ffs (mask) - 1; curoff = mffs (mask) - 1;
curclient = curoff + (i * (sizeof(fd_mask)*8)); curclient = curoff + (i * (sizeof(fd_mask)*8));
FD_ZERO(&tmask); FD_ZERO(&tmask);
FD_SET(curclient, &tmask); FD_SET(curclient, &tmask);
......
...@@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput; ...@@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput;
extern WorkQueuePtr workQueue; extern WorkQueuePtr workQueue;
/* added by raphael */ /* in WaitFor.c */
#define ffs mffs #define ffs mffs
extern int mffs(fd_mask); extern int mffs(fd_mask);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment