Bug 785860 - fix sts preload list tests to skip private mode tests if private browsin...
[gecko.git] / mfbt / Likely.h
bloba217e60c68e490250e7656e50078e34fc1074387
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_ */