Lunchbox  1.4.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 #endif
00030 
00031 // Defining our own min/max macros seems to be the only sane way to get this
00032 // functionality across platforms thanks to some screwup in the MS header files.
00033 #define LB_MAX(a,b) ((a)>(b)?(a):(b)) //!< returns the maximum of two values
00034 #define LB_MIN(a,b) ((a)<(b)?(a):(b)) //!< returns the minimum of two values
00035 
00037 #define LB_UNDEFINED_UINT32   (0xffffffffu)
00038 
00040 #define LB_MAX_UINT32         (0xfffffff0u)
00041 
00043 #define LB_TIMEOUT_INDEFINITE 0xffffffffu // Attn: identical to Win32 INFINITE!
00044 
00046 #define LB_TIMEOUT_DEFAULT 0xfffffffeu
00047 
00048 #ifdef __GNUC__
00049 #  define LB_LIKELY(x)       __builtin_expect( (x), 1 )
00050 #  define LB_UNLIKELY(x)     __builtin_expect( (x), 0 )
00051 #else
00052 #  define LB_LIKELY(x)       x
00053 #  define LB_UNLIKELY(x)     x
00054 #endif
00055 
00056 #endif // LUNCHBOX_DEFINES_H