diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-16 20:36:54 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-16 20:36:54 +0000 |
commit | 5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b (patch) | |
tree | d16a1846265310a31d8aa02c3276306240772ce8 /syshead.h | |
parent | Copyright change OpenVPN Solutions LLC -> Telethra, Inc. (diff) | |
download | openvpn-5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b.tar.xz |
Added likely() and unlikely() branch prediction hint macros
to syshead.h
Introduced BUF_MAX constant to limit struct buffer offset and length
values. BUF_MAX has been set to 2^20.
Use likely() and unlikely() macros in buffer.h code to allow the
compiler to generate more efficient code.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3058 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'syshead.h')
-rw-r--r-- | syshead.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -36,6 +36,15 @@ #endif #endif +/* branch prediction hints */ +#if defined(__GNUC__) +# define likely(x) __builtin_expect((x),1) +# define unlikely(x) __builtin_expect((x),0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif + #if defined(_WIN32) && !defined(WIN32) #define WIN32 #endif |