mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:29:14 +02:00
* hopefully proper fix for 8 and 16 bit CPUs
git-svn-id: trunk@36473 -
This commit is contained in:
parent
0fe5541459
commit
f25c9c0956
@ -1,16 +1,21 @@
|
|||||||
|
{**********************************************************************************************
|
||||||
|
Please modify this test only if you know exactly what you are doing
|
||||||
|
**********************************************************************************************}
|
||||||
uses
|
uses
|
||||||
math;
|
math;
|
||||||
const
|
const
|
||||||
{$if defined(CPU8) or defined(CPU16)}
|
{$if defined(CPU8) or defined(CPU16)}
|
||||||
lg2upperlimit = 14;
|
lg2upperlimit = 14;
|
||||||
|
upperrandomlimit= high(word) div 8;
|
||||||
{$else}
|
{$else}
|
||||||
lg2upperlimit = 22;
|
lg2upperlimit = 22;
|
||||||
|
upperrandomlimit= high(word);
|
||||||
{$endif}
|
{$endif}
|
||||||
var
|
var
|
||||||
a : array of word;
|
a : array of word;
|
||||||
i,j : longint;
|
i,j : longint;
|
||||||
upperlimit : longint;
|
upperlimit : longint;
|
||||||
histogram : array[0..high(word)] of longint;
|
histogram : array[0..upperrandomlimit] of longint;
|
||||||
entropy : double;
|
entropy : double;
|
||||||
begin
|
begin
|
||||||
randomize;
|
randomize;
|
||||||
@ -19,7 +24,7 @@ begin
|
|||||||
upperlimit:=1 shl i;
|
upperlimit:=1 shl i;
|
||||||
setlength(a,upperlimit);
|
setlength(a,upperlimit);
|
||||||
for j:=0 to upperlimit-1 do
|
for j:=0 to upperlimit-1 do
|
||||||
a[j]:=random(high(word)+1);
|
a[j]:=random(upperrandomlimit+1);
|
||||||
FillChar(histogram,sizeof(histogram),0);
|
FillChar(histogram,sizeof(histogram),0);
|
||||||
for j:=0 to upperlimit-1 do
|
for j:=0 to upperlimit-1 do
|
||||||
inc(histogram[a[j]]);
|
inc(histogram[a[j]]);
|
||||||
|
Loading…
Reference in New Issue
Block a user