-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
46 lines (39 loc) · 1.14 KB
/
common.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
/*
* common.h
*
* Copyright (C) 2011 NEC Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _COMMON_H
#define _COMMON_H
#define TRUE (1)
#define FALSE (0)
#define ERROR (-1)
#ifndef LONG_MAX
#define LONG_MAX ((long)(~0UL>>1))
#endif
#ifndef ULONG_MAX
#define ULONG_MAX (~0UL)
#endif
#define ULONGLONG_MAX (~0ULL)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define divideup(x, y) (((x) + ((y) - 1)) / (y))
#define round(x, y) (((x) / (y)) * (y))
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
/*
* Incorrect address
*/
#define NOT_MEMMAP_ADDR (0x0)
#define NOT_KV_ADDR (0x0)
#define NOT_PADDR (ULONGLONG_MAX)
#endif /* COMMON_H */