3 * @brief utility macro header.
5 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6 * Copyright (C) 2009 NTT COMWARE Corporation.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 **********************************************************************/
28 //! gcc extension code output macro.
29 //! static "if" weight algorithm teach compiler.
30 //! compiler output CPU TBL code.
32 //! if( likely( hoge ) ){ fastcall } else { slowcall }
33 //! if( unlikely( hoge ) ){ slowcall } else { fastcall }
34 #define likely(c) __builtin_expect(!!(c), 1)
35 #define unlikely(c) __builtin_expect(!!(c), 0)
37 #endif //__UTILITY_H__