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 
24  // Open and write
25  fd = open("input.data", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
26  assert( fd>0 && "Couldn't open input data file" );
27  data_to_input(fd, (void *)(&data));
28 
29  return 0;
30 }
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
uint_fast16_t i
Definition: support.h:78
#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