Lunchbox  1.8.0
defines.h
1 
2 /* Copyright (c) 2010-2012, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef LUNCHBOX_DEFINES_H
19 #define LUNCHBOX_DEFINES_H
20 
21 #ifdef __APPLE__
22 # include <lunchbox/definesDarwin.h>
23 #endif
24 #ifdef __linux
25 # include <lunchbox/definesLinux.h>
26 #endif
27 #ifdef _WIN32 //_MSC_VER
28 # include <lunchbox/definesWin32.h>
29 # ifndef WIN32
30 # define WIN32
31 # endif
32 # ifndef WIN32_API
33 # define WIN32_API
34 # endif
35 # ifndef WIN32_LEAN_AND_MEAN
36 # define WIN32_LEAN_AND_MEAN
37 # endif
38 #endif
39 
40 // Defining our own min/max macros seems to be the only sane way to get this
41 // functionality across platforms thanks to some screwup in the MS header files.
42 #define LB_MAX(a,b) ((a)>(b)?(a):(b))
43 #define LB_MIN(a,b) ((a)<(b)?(a):(b))
44 
45 
46 #define LB_UNDEFINED_UINT16 (0xffffu)
47 
49 #define LB_UNDEFINED_UINT32 (0xffffffffu)
50 
52 #define LB_UNDEFINED_UINT64 (0xffffffffffffffffull)
53 
55 #define LB_MAX_UINT32 (0xfffffff0u)
56 
58 #define LB_TIMEOUT_INDEFINITE 0xffffffffu // Attn: identical to Win32 INFINITE!
59 
61 #define LB_TIMEOUT_DEFAULT 0xfffffffeu
62 
63 #ifdef __GNUC__
64 # define LB_LIKELY(x) __builtin_expect( (x), 1 )
65 # define LB_UNLIKELY(x) __builtin_expect( (x), 0 )
66 #else
67 # define LB_LIKELY(x) x
68 # define LB_UNLIKELY(x) x
69 #endif
70 
71 #endif // LUNCHBOX_DEFINES_H