Skip to content

Commit f81f49c

Browse files
authored
Merge pull request #12 from paweld/gus
fixed compilation in delphi
2 parents 3570fd9 + 3a296e2 commit f81f49c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

generator/Common/generate.common.pas

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,20 @@ function TGenerator.GenerateProgressBar(APBPosition, APBMax, APBWIdth, AFileSize
160160
ATimeElapsed)]);
161161
end;
162162

163-
function TGenerator.Rng1brc(Range: longint): longint;
163+
function TGenerator.Rng1brc(Range: Integer): Integer;
164164
var
165165
s0, s1, s2: Cardinal;
166+
i0, i1: Int64;
166167
begin
167168
s0 := rndState[0];
168169
s1 := rndState[1] xor s0;
169-
s2 := ((s1 * 3) xor 5) * 7;
170-
Result := longint(Int64(s2 * range) shr 32);
170+
i0 := ((Int64(s1) * 3) xor 5) * 7;
171+
s2 := i0 and $FFFFFFFF;
172+
i1 := Int64(s2) * range;
173+
Result := Integer(i1 shr 32);
171174
rndState[0] := s2;
172-
rndState[1] := s0 xor (s1 shl 9);
175+
i0 := s0 xor (Int64(s1) shl 9);
176+
rndState[1] := i0 and $FFFFFFFF;
173177
end;
174178

175179
procedure TGenerator.Generate;

0 commit comments

Comments
 (0)