Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

compilerMacros.h

Go to the documentation of this file.
00001 // Header file defining compiler specific macros.
00002 
00003 
00004 /*
00005     Copyright (C) 2004-2005 Daniel Vallstrom. All rights reserved.
00006 
00007     Unless explicitly acquired and licensed from Licensor under a license
00008     other than the Reciprocal Public License ("RPL"), the contents of this
00009     file are subject to the RPL Version 1.1, or subsequent versions as
00010     allowed by the RPL, and You may not copy or use this file in either
00011     source code or executable form, except in compliance with the terms
00012     and conditions of the RPL.
00013 
00014     You should be able to find a copy of the RPL (the "License") in a file
00015     named LICENSE that should come along with this file; if not, write to
00016     vallst@gmail.com.
00017 
00018     All software distributed under the License is provided in the hope
00019     that it will be useful, but WITHOUT ANY WARRANTY; without even the
00020     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00021     PURPOSE. See the License for more details.
00022 */
00023 
00024 
00025 #ifndef compiler_H
00026 #define compiler_H
00027 
00028 
00029 // Used to indicate that an expression is likely to be true or false. E.g:
00030 // "if ( Unlikely( k == 0 ) ) {...}"
00031 #ifdef __GNUC__
00032   #define Likely(e)    ( __builtin_expect( !!(e), 1 ) )
00033   #define Likely1(e)   ( __builtin_expect(   (e), 1 ) )
00034   #define Unlikely(e)  ( __builtin_expect(   (e), 0 ) )
00035 #else
00036   #define Likely(e)    (e)
00037   #define Likely1(e)   (e)
00038   #define Unlikely(e)  (e)
00039 #endif
00040 
00041 
00042 // Typically used to indicate that a function parameter isn't used,
00043 // suppressing compiler warnings. For example:
00044 //     int constantEvil( int dummyArg attribute__(unused) ) { return 666; }
00045 #ifdef __GNUC__
00046   #define attribute__(a)  __attribute__ ((a))
00047 #else
00048   #define attribute__(a)  
00049 #endif
00050 
00051 
00052 #endif // compiler_H

Copyright (C) 2004-2005 Daniel Vallstrom. See the various vallst files for license notices.

Generated on Mon Jul 18 11:34:14 2005 for Vallst by doxygen 1.4.3.