unit fd_utils;\r
interface\r
\r
+const\r
+ FDwordshift=5;\r
+ FDwordmaxbit=(1 shl FDwordshift)-1;\r
+\r
type\r
- FDSet= Array [0..255] of longint; {31}\r
+ FDword=longint;\r
+ FDSet= Array [0..255] of fdword; {31}\r
PFDSet= ^FDSet;\r
\r
Procedure FD_Clr(fd:longint;var fds:fdSet);\r
{ Remove fd from the set of filedescriptors}\r
begin\r
if (fd < 0) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd));\r
- fds[fd shr 5]:=fds[fd shr 5] and (not (1 shl (fd and 31)));\r
+ fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] and (not (1 shl (fd and fdwordmaxbit)));\r
end;\r
\r
Procedure FD_Zero(var fds:fdSet);\r
{ Add fd to the set of filedescriptors }\r
begin\r
if (fd < 0) then raise exception.create('FD_set fd out of range: '+inttostr(fd));\r
- fds[fd shr 5]:=fds[fd shr 5] or (1 shl (fd and 31));\r
+ fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] or (1 shl (fd and fdwordmaxbit));\r
end;\r
\r
Function FD_IsSet(fd:longint;var fds:fdSet):boolean;{$ifdef useinline}inline;{$endif}\r
result := false;\r
exit;\r
end;\r
- FD_IsSet:=((fds[fd shr 5] and (1 shl (fd and 31)))<>0);\r
+ FD_IsSet:=((fds[fd shr fdwordshift] and (1 shl (fd and fdwordmaxbit)))<>0);\r
end;\r
end.\r