|
@@ -39,8 +39,11 @@ procedure memset(var x; value: byte; count: size_t); cdecl; external clib;
|
|
|
|
|
|
Procedure FillChar(var x;count: sizeint;value:byte);{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
Procedure FillChar(var x;count: sizeint;value:byte);{$ifdef SYSTEMINLINE}inline;{$endif}
|
|
begin
|
|
begin
|
|
- if count <= 0 then
|
|
|
|
- exit;
|
|
|
|
|
|
+ { don't exit if count is <= 0, this makes the compiler think x is uninitialized,
|
|
|
|
+ as FillChar is probably rarely called with count <= 0, the performance hit is
|
|
|
|
+ probably neglible }
|
|
|
|
+ if count < 0 then
|
|
|
|
+ count := 0;
|
|
memset(x,value,size_t(count));
|
|
memset(x,value,size_t(count));
|
|
end;
|
|
end;
|
|
{$endif FPC_SYSTEM_HAS_FILLCHAR}
|
|
{$endif FPC_SYSTEM_HAS_FILLCHAR}
|