-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.hh
36 lines (26 loc) · 907 Bytes
/
util.hh
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
#ifndef UTIL_HH_
#define UTIL_HH_
#include <unistd.h>
#include <iostream>
#include <sstream>
#include "log.h"
// Round a value x up to the next multiple of y
#define ROUND_UP(x, y) ((x) % (y) == 0 ? (x) : (x) + ((y) - (x) % (y)))
// Round a value x down to the next multiple of y
#define ROUND_DOWN(x, y) ((x) % (y) == 0 ? (x) : (x) - ((x) % (y)))
// Constants
#define MAX_STACK_SIZE (PAGE_SIZE * 20)
#define HEAP_SIZE 512 * 1024
#define SUBHEAP_SIZE (HEAP_SIZE / NUM_SUBHEAP)
#define NUM_SUBHEAP 16
#define GLOBAL_SIZE 512 * 1024 * 1024
#define PAGE_SIZE 0x1000
#define MIN_ALIGNED_SIZE 16
//#define LOGPRINT
#define NO_ORDER
extern int shm_fd; // File descriptor for shared memory object
extern void* local_heap; // Local view of the state
extern void* global_heap; // Latest committed state of the global_heap
// Initialize the global heap
void GlobalHeapInit();
#endif // UTIL_HH_