-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.h
79 lines (63 loc) · 1.1 KB
/
utils.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef UTILS_H
#define UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h> // for printf
#include <stdlib.h> // for posix_memalign
#include <string.h> // for memset
#include <math.h> // for sqrt
#include <float.h> //for FLT_MAX
#include <time.h> // for clock_gettime
#include <cblas.h>
#define STACK_SIZE_TOTAL 0x8000000 // 128Mbytes
typedef struct
{
int index;
float score;
}score_index_struct;
typedef struct
{
float x;
float y;
float w;
float h;
}box_struct;
typedef struct
{
void *stack_starting_address;
char *stack_current_address;
unsigned int stack_current_alloc_size;
}stack_struct;
void init_stack
(
void
);
void free_stack
(
void
);
void *alloc_from_stack
(
unsigned int len
);
void partial_free_from_stack
(
unsigned int len
);
unsigned int get_stack_current_alloc_size
(
void
);
void reset_stack_ptr_to_assigned_position
(
unsigned int assigned_size
);
double what_time_is_it_now
(
void
);
#ifdef __cplusplus
}
#endif
#endif // UTILS_H