blob: aa451fd59e92623c5c0b9df2b889d42db686b53e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2011 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef MACROS_H
#define MACROS_H
/**
\file macros.h
\brief This file is for listing reusable macros used in the BibleTime source code.
*/
/**
\def DEPRECATED(func)
\brief Macro for declaring functions and methods as deprecated.
*/
#ifdef __GNUC__
#define DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED(func) __declspec(deprecated) func
#else
#define DEPRECATED(func) func
#endif
/**
\def LIKELY(c)
\brief Gives the compiler a hint that the given conditional is likely to
evaluate to true.
This helps GCC to generate code which is optimized in respect to branch
prediction.
*/
/**
\def UNLIKELY(c)
\brief Gives the compiler a hint that the given conditional is likely to
evaluate to false.
This helps GCC to generate code which is optimized in respect to branch
prediction.
*/
#ifdef __GNUC__
#define LIKELY(c) __builtin_expect(!!(c),true)
#define UNLIKELY(c) __builtin_expect(!!(c),false)
#else
#define LIKELY(c) !!(c)
#define UNLIKELY(c) !!(c)
#endif
#endif // #ifdef MACROS_H
|