X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/82d4e52fba54be50d719f6185ec381f2dc87fc6c..8a616f3f3967a8446407e6a63f675d19191ad568:/fd_utils.pas?ds=sidebyside diff --git a/fd_utils.pas b/fd_utils.pas index de89e5f..290eb05 100755 --- a/fd_utils.pas +++ b/fd_utils.pas @@ -23,8 +23,13 @@ unit fd_utils; interface +const + FDwordshift=5; + FDwordmaxbit=(1 shl FDwordshift)-1; + type - FDSet= Array [0..255] of longint; {31} + FDword=longint; + FDSet= Array [0..255] of fdword; {31} PFDSet= ^FDSet; Procedure FD_Clr(fd:longint;var fds:fdSet); @@ -44,7 +49,7 @@ Procedure FD_Clr(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif} { Remove fd from the set of filedescriptors} begin if (fd < 0) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd)); - fds[fd shr 5]:=fds[fd shr 5] and (not (1 shl (fd and 31))); + fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] and (not (1 shl (fd and fdwordmaxbit))); end; Procedure FD_Zero(var fds:fdSet); @@ -57,7 +62,7 @@ Procedure FD_Set(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif} { Add fd to the set of filedescriptors } begin if (fd < 0) then raise exception.create('FD_set fd out of range: '+inttostr(fd)); - fds[fd shr 5]:=fds[fd shr 5] or (1 shl (fd and 31)); + fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] or (1 shl (fd and fdwordmaxbit)); end; Function FD_IsSet(fd:longint;var fds:fdSet):boolean;{$ifdef useinline}inline;{$endif} @@ -67,6 +72,6 @@ begin result := false; exit; end; - FD_IsSet:=((fds[fd shr 5] and (1 shl (fd and 31)))<>0); + FD_IsSet:=((fds[fd shr fdwordshift] and (1 shl (fd and fdwordmaxbit)))<>0); end; end.