Graphing tweaks.
[beedb.git] / include / beedb.h
blobe70744fa8efa414090eb27d8e5ead49f2c323511
1 /*
2 Copyright 2008 Kristian Nielsen
4 This file is part of BeeDB.
6 Foobar is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
11 Foobar is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21 This header contains general definitions used throughout all of the BeeDB
22 source code, and should be included as the first non-system header in all
23 BeeDB C++ source code.
25 Note that because of this, this header should be kept fairly slim and should
26 _not_ contain any stuff not of general interest to BeeDB code, ie. do not
27 include definitions that are used only in one or a few modules.
30 /* We need UINT64_MAX and friends. */
31 #ifndef __STDC_LIMIT_MACROS
32 #define __STDC_LIMIT_MACROS
33 #endif
34 #include <stdint.h>
36 #include "port/beedb.h"
39 typedef unsigned int uint;
42 #ifdef __GNUC__
44 #define likely(x) __builtin_expect(!!(x), 1)
45 #define unlikely(x) __builtin_expect(!!(x), 0)
47 #define NOINLINE __attribute__((noinline))
49 #else
51 #define likely(x) (x)
52 #define unlikely(x) (x)
54 #define NOINLINE
55 #endif
58 Preprocessor trick needed to convert number to string, eg. for putting
59 __LINE__ into a string literal.
61 #define MACRO_NUMBER_TO_STRING2(n) #n
62 #define MACRO_NUMBER_TO_STRING(n) MACRO_NUMBER_TO_STRING2(n)