Lunchbox  1.6.0
defines.h
00001 
00002 /* Copyright (c) 2010-2012, Stefan Eilemann <eile@eyescale.ch>
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef LUNCHBOX_DEFINES_H
00019 #define LUNCHBOX_DEFINES_H
00020 
00021 #ifdef __APPLE__
00022 #  include <lunchbox/definesDarwin.h>
00023 #endif
00024 #ifdef __linux
00025 #  include <lunchbox/definesLinux.h>
00026 #endif
00027 #ifdef _WIN32 //_MSC_VER
00028 #  include <lunchbox/definesWin32.h>
00029 #  ifndef WIN32
00030 #    define WIN32
00031 #  endif
00032 #  ifndef WIN32_API
00033 #    define WIN32_API
00034 #  endif
00035 #  ifndef WIN32_LEAN_AND_MEAN
00036 #    define WIN32_LEAN_AND_MEAN
00037 #  endif
00038 #endif
00039 
00040 // Defining our own min/max macros seems to be the only sane way to get this
00041 // functionality across platforms thanks to some screwup in the MS header files.
00042 #define LB_MAX(a,b) ((a)>(b)?(a):(b)) //!< returns the maximum of two values
00043 #define LB_MIN(a,b) ((a)<(b)?(a):(b)) //!< returns the minimum of two values
00044 
00046 #define LB_UNDEFINED_UINT32   (0xffffffffu)
00047 
00049 #define LB_MAX_UINT32         (0xfffffff0u)
00050 
00052 #define LB_TIMEOUT_INDEFINITE 0xffffffffu // Attn: identical to Win32 INFINITE!
00053 
00055 #define LB_TIMEOUT_DEFAULT 0xfffffffeu
00056 
00057 #ifdef __GNUC__
00058 #  define LB_LIKELY(x)       __builtin_expect( (x), 1 )
00059 #  define LB_UNLIKELY(x)     __builtin_expect( (x), 0 )
00060 #else
00061 #  define LB_LIKELY(x)       x
00062 #  define LB_UNLIKELY(x)     x
00063 #endif
00064 
00065 #endif // LUNCHBOX_DEFINES_H