Back to index

enigmail  1.4.3
Likely.h
Go to the documentation of this file.
00001 /* This Source Code Form is subject to the terms of the Mozilla Public
00002  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
00003  * You can obtain one at http://mozilla.org/MPL/2.0/. */
00004 
00005 /*
00006  * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
00007  * boolean predicate should be branch-predicted.
00008  */
00009 
00010 #ifndef Likely_h_
00011 #define Likely_h_
00012 
00013 #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
00014 #  define MOZ_LIKELY(x)   (__builtin_expect((x), 1))
00015 #  define MOZ_UNLIKELY(x) (__builtin_expect((x), 0))
00016 #else
00017 #  define MOZ_LIKELY(x)   (x)
00018 #  define MOZ_UNLIKELY(x) (x)
00019 #endif
00020 
00021 #endif /* Likely_h_ */