diff options
author | 2006-10-20 12:37:13 +0000 | |
---|---|---|
committer | 2006-10-20 12:37:13 +0000 | |
commit | ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch) | |
tree | 50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/em3d/util.c | |
parent | 43668d9109b1f36329646fd07324d435be6f0050 (diff) |
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.)
rapportCompcert_all.txt liste les erreurs produites par ccomp.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/em3d/util.c')
-rw-r--r-- | test/ccured_olden/em3d/util.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/ccured_olden/em3d/util.c b/test/ccured_olden/em3d/util.c new file mode 100644 index 0000000..3dc5592 --- /dev/null +++ b/test/ccured_olden/em3d/util.c @@ -0,0 +1,34 @@ +#define CONST_seed 45 +#include <stdlib.h> + +/* initialize the random number generator for a particular processor */ +void init_random(int myid) +{ + srand48(myid*CONST_seed); +} + +/* return a random number from 0 to range-1 */ +int gen_number(int range) +{ + return lrand48() % range; +} + +/* return a random number in [-range+1,range-1] */ +int gen_signed_number(int range) +{ + int temp; + + temp = lrand48() % (2*range-1); /* 0..2*range-2 */ + return temp-(range-1); +} + +/* Generate a double from 0.0 to 1.0 */ +double gen_uniform_double() +{ + return drand48(); +} + +int check_percent(int percent) +{ + return (drand48() < (double) (percent/100.0)); +} |