diff options
author | sasha@mysql.sashanet.com <> | 2002-01-26 22:26:24 -0700 |
---|---|---|
committer | sasha@mysql.sashanet.com <> | 2002-01-26 22:26:24 -0700 |
commit | 7275dcef35d14ff5f82f3520fe6e6e0766bc13b5 (patch) | |
tree | 7805cfd6c7eb661c4f3022b7fc37478a0908a190 /include/my_global.h | |
parent | 40fcae6d4b7c02e6cd18b98d8d3b8c525e51aeae (diff) | |
download | mariadb-git-7275dcef35d14ff5f82f3520fe6e6e0766bc13b5.tar.gz |
misc replication bugfixes including some needed modifications in IO_CACHE
likely() and unlikely() branch prediction compiler hint macros
clean-up of comments
Diffstat (limited to 'include/my_global.h')
-rw-r--r-- | include/my_global.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h index 7277bdcd715..40e70c521eb 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -51,6 +51,22 @@ #endif #endif /* _WIN32... */ +/* The macros below are borrowed from include/linux/compiler.h in the + Linux kernel. Use them to indicate the likelyhood of the truthfulness + of a condition. This serves two purposes - newer versions of gcc will be + able to optimize for branch predication, which could yield siginficant + performance gains in frequently executed sections of the code, and the + other reason to use them is for documentation +*/ + +#if __GNUC__ == 2 && __GNUC_MINOR__ < 96 +#define __builtin_expect(x, expected_value) (x) +#endif + +#define likely(x) __builtin_expect((x),1) +#define unlikely(x) __builtin_expect((x),0) + + /* Fix problem with S_ISLNK() on Linux */ #if defined(HAVE_LINUXTHREADS) #undef _GNU_SOURCE |