Add CRYPTOPP_LIKELY and CRYPTOPP_UNLIKELY macros
parent
8d227675a9
commit
7ae1267673
12
misc.h
12
misc.h
|
|
@ -114,6 +114,18 @@ NAMESPACE_BEGIN(CryptoPP)
|
|||
// Forward declaration for IntToString specialization
|
||||
class Integer;
|
||||
|
||||
// ************** branch prediction ***************
|
||||
|
||||
// Micro-optimization, use juditiously. Be sure you find a hotspot
|
||||
// using 'make coverage', and its in a tight loop. Otherwise, DFW.
|
||||
#if defined(__GNUC__)
|
||||
# define CRYPTOPP_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
# define CRYPTOPP_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
# define CRYPTOPP_LIKELY(x) (x)
|
||||
# define CRYPTOPP_UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
// ************** compile-time assertion ***************
|
||||
|
||||
#if CRYPTOPP_DOXYGEN_PROCESSING
|
||||
|
|
|
|||
Loading…
Reference in New Issue