• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

compiler_opt.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  * 
00004  * Copyright (C) 2007 iptelorg GmbH
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 
00048 /* 
00049  * History:
00050  * --------
00051  *  2007-05-14  created by andrei
00052  */
00053 
00054 #ifndef __compiler_opt_h
00055 #define __compiler_opt_h
00056 
00057 /* likely/unlikely */
00058 #if __GNUC__ >= 3
00059 
00060 #define likely(expr)              __builtin_expect(!!(expr), 1)
00061 #define unlikely(expr)            __builtin_expect(!!(expr), 0)
00062 
00063 #else /* __GNUC__ */
00064 
00065 /* #warning "No compiler optimizations supported try gcc 4.x" */
00066 #define likely(expr) (expr)
00067 #define unlikely(expr) (expr)
00068 
00069 #endif /* __GNUC__ */
00070 
00071 
00072 
00073 /* prefetch* */
00074 #if ( __GNUC__ > 3 ) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
00075 
00076 #define prefetch(addr)            __builtin_prefetch((addr))
00077 #define prefetch_w(addr)          __builtin_prefetch((addr), 1)
00078 #define prefetch_loc_r(addr, loc) __builtin_prefetch((addr), 0, (loc))
00079 #define prefetch_loc_w(addr, loc) __builtin_prefetch((addr), 1, (loc))
00080 
00081 #else
00082 
00083 #define prefetch(addr)
00084 #define prefetch_w(addr)
00085 #define prefetch_loc_r(addr, loc)
00086 #define prefetch_loc_w(addr, loc)
00087 
00088 #endif /* __GNUC__ > 3  || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) */
00089 
00090 #endif

Generated on Tue May 22 2012 13:10:04 for SIP Router by  doxygen 1.7.1