annotate DEPENDENCIES/generic/include/boost/lockfree/detail/branch_hints.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // branch hints
Chris@16 2 // Copyright (C) 2007, 2008 Tim Blechmann
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 5 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7
Chris@16 8 #ifndef BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED
Chris@16 9 #define BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED
Chris@16 10
Chris@16 11 namespace boost {
Chris@16 12 namespace lockfree {
Chris@16 13 namespace detail {
Chris@16 14 /** \brief hint for the branch prediction */
Chris@16 15 inline bool likely(bool expr)
Chris@16 16 {
Chris@16 17 #ifdef __GNUC__
Chris@16 18 return __builtin_expect(expr, true);
Chris@16 19 #else
Chris@16 20 return expr;
Chris@16 21 #endif
Chris@16 22 }
Chris@16 23
Chris@16 24 /** \brief hint for the branch prediction */
Chris@16 25 inline bool unlikely(bool expr)
Chris@16 26 {
Chris@16 27 #ifdef __GNUC__
Chris@16 28 return __builtin_expect(expr, false);
Chris@16 29 #else
Chris@16 30 return expr;
Chris@16 31 #endif
Chris@16 32 }
Chris@16 33
Chris@16 34 } /* namespace detail */
Chris@16 35 } /* namespace lockfree */
Chris@16 36 } /* namespace boost */
Chris@16 37
Chris@16 38 #endif /* BOOST_LOCKFREE_BRANCH_HINTS_HPP_INCLUDED */