bug 818009 - canActivate: only click-to-play-type plugins are valid r=jaws
[gecko.git] / mfbt / Likely.h
blobf22a14e882b61b6fbb6dd196cbfcb3a1dba0f597
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
8 * boolean predicate should be branch-predicted.
9 */
11 #ifndef mozilla_Likely_h_
12 #define mozilla_Likely_h_
14 #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
15 # define MOZ_LIKELY(x) (__builtin_expect(!!(x), 1))
16 # define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
17 #else
18 # define MOZ_LIKELY(x) (!!(x))
19 # define MOZ_UNLIKELY(x) (!!(x))
20 #endif
22 #endif /* mozilla_Likely_h_ */