PandA-2024.02
generate.c
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <assert.h>
9 
10 #include "sort.h"
11 
12 int main(int argc, char **argv)
13 {
14  struct bench_args_t data;
15  int i, fd;
16  struct prng_rand_t state;
17 
18  // Fill data structure
19  prng_srand(1,&state);
20  for(i=0; i<SIZE; i++)
21  data.a[i] = prng_rand(&state) & TYPE_MAX;
22 
23  // Open and write
24  fd = open("input.data", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
25  assert( fd>0 && "Couldn't open input data file" );
26  data_to_input(fd, (void *)(&data));
27 
28  return 0;
29 }
static uint64_t prng_rand(struct prng_rand_t *state)
Definition: support.h:85
TYPE a[SIZE]
Definition: sort.h:16
void data_to_input(int fd, void *vdata)
Definition: local_support.c:34
#define TYPE_MAX
Definition: sort.h:8
#define SIZE
Definition: adpcm.c:775
int main(int argc, char **argv)
Definition: generate.c:12
static void prng_srand(uint64_t seed, struct prng_rand_t *state)
Definition: support.h:106

Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by doxygen 1.8.13