1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Copyright (C) 2009 The Android Open Source Project 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*61046927SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*61046927SAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*61046927SAndroid Build Coastguard Worker * 8*61046927SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*61046927SAndroid Build Coastguard Worker * 10*61046927SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*61046927SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*61046927SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*61046927SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*61046927SAndroid Build Coastguard Worker * limitations under the License. 15*61046927SAndroid Build Coastguard Worker */ 16*61046927SAndroid Build Coastguard Worker 17*61046927SAndroid Build Coastguard Worker #ifndef ANDROID_CUTILS_COMPILER_H 18*61046927SAndroid Build Coastguard Worker #define ANDROID_CUTILS_COMPILER_H 19*61046927SAndroid Build Coastguard Worker 20*61046927SAndroid Build Coastguard Worker /* 21*61046927SAndroid Build Coastguard Worker * helps the compiler's optimizer predicting branches 22*61046927SAndroid Build Coastguard Worker */ 23*61046927SAndroid Build Coastguard Worker 24*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus 25*61046927SAndroid Build Coastguard Worker # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true )) 26*61046927SAndroid Build Coastguard Worker # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false )) 27*61046927SAndroid Build Coastguard Worker #else 28*61046927SAndroid Build Coastguard Worker # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 )) 29*61046927SAndroid Build Coastguard Worker # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 )) 30*61046927SAndroid Build Coastguard Worker #endif 31*61046927SAndroid Build Coastguard Worker 32*61046927SAndroid Build Coastguard Worker /** 33*61046927SAndroid Build Coastguard Worker * exports marked symbols 34*61046927SAndroid Build Coastguard Worker * 35*61046927SAndroid Build Coastguard Worker * if used on a C++ class declaration, this macro must be inserted 36*61046927SAndroid Build Coastguard Worker * after the "class" keyword. For instance: 37*61046927SAndroid Build Coastguard Worker * 38*61046927SAndroid Build Coastguard Worker * template <typename TYPE> 39*61046927SAndroid Build Coastguard Worker * class ANDROID_API Singleton { } 40*61046927SAndroid Build Coastguard Worker */ 41*61046927SAndroid Build Coastguard Worker 42*61046927SAndroid Build Coastguard Worker #define ANDROID_API __attribute__((visibility("default"))) 43*61046927SAndroid Build Coastguard Worker 44*61046927SAndroid Build Coastguard Worker #endif // ANDROID_CUTILS_COMPILER_H 45