Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / external_libraries / boost-lockfree / boost / lockfree / detail / branch_hints.hpp
blob3a193f8b24a98e0220f28a4f05792d664ce4c486
1 // branch hints
2 // Copyright (C) 2007, 2008 Tim Blechmann
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED
9 #define BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED
11 namespace boost {
12 namespace lockfree {
13 namespace detail {
14 /** \brief hint for the branch prediction */
15 inline bool likely(bool expr)
17 #ifdef __GNUC__
18 return __builtin_expect(expr, true);
19 #else
20 return expr;
21 #endif
24 /** \brief hint for the branch prediction */
25 inline bool unlikely(bool expr)
27 #ifdef __GNUC__
28 return __builtin_expect(expr, false);
29 #else
30 return expr;
31 #endif
34 } /* namespace detail */
35 } /* namespace lockfree */
36 } /* namespace boost */
38 #endif /* BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED */