forked from embench/embench-iot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbeebsc.h
65 lines (44 loc) · 1.64 KB
/
beebsc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* BEEBS local library variants header
Copyright (C) 2019 Embecosm Limited.
Contributor Jeremy Bennett <[email protected]>
This file is part of Embench and was formerly part of the Bristol/Embecosm
Embedded Benchmark Suite.
SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef BEEBSC_H
#define BEEBSC_H
#include <stddef.h>
/* BEEBS fixes RAND_MAX to its lowest permitted value, 2^15-1 */
#ifdef RAND_MAX
#undef RAND_MAX
#endif
#define RAND_MAX ((1U << 15) - 1)
/* Common understanding of a "small value" (epsilon) for floating point
comparisons. */
#define VERIFY_DOUBLE_EPS 1.0e-13
#define VERIFY_FLOAT_EPS 1.0e-5
/* Simplified assert.
The full complexity of assert is not needed for a benchmark. See the
discussion at:
https://lists.librecores.org/pipermail/embench/2019-August/000007.html
This function just*/
#define assert_beebs(expr) { if (!(expr)) exit (1); }
#define float_eq_beebs(exp, actual) (fabsf(exp - actual) < VERIFY_FLOAT_EPS)
#define float_neq_beebs(exp, actual) !float_eq_beebs(exp, actual)
#define double_eq_beebs(exp, actual) (fabs(exp - actual) < VERIFY_DOUBLE_EPS)
#define double_neq_beebs(exp, actual) !double_eq_beebs(exp, actual)
/* Local simplified versions of library functions */
int rand_beebs (void);
void srand_beebs (unsigned int new_seed);
void init_heap_beebs (void *heap, const size_t heap_size);
int check_heap_beebs (void *heap);
void *malloc_beebs (size_t size);
void *calloc_beebs (size_t nmemb, size_t size);
void *realloc_beebs (void *ptr, size_t size);
void free_beebs (void *ptr);
#endif /* BEEBSC_H */
/*
Local Variables:
mode: C
c-file-style: "gnu"
End:
*/