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