summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsasha@mysql.sashanet.com <>2002-01-26 22:26:24 -0700
committersasha@mysql.sashanet.com <>2002-01-26 22:26:24 -0700
commit7275dcef35d14ff5f82f3520fe6e6e0766bc13b5 (patch)
tree7805cfd6c7eb661c4f3022b7fc37478a0908a190 /include
parent40fcae6d4b7c02e6cd18b98d8d3b8c525e51aeae (diff)
downloadmariadb-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')
-rw-r--r--include/my_global.h16
-rw-r--r--include/my_sys.h5
2 files changed, 19 insertions, 2 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
diff --git a/include/my_sys.h b/include/my_sys.h
index 1d7c0b7ddb1..61f93d665cd 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -436,8 +436,9 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
#define my_b_tell(info) ((info)->pos_in_file + \
(uint) (*(info)->current_pos - (info)->request_pos))
-#define my_b_append_tell(info) ((info)->end_of_file + \
- (uint) ((info)->write_pos - (info)->write_buffer))
+
+/* tell write offset in the SEQ_APPEND cache */
+my_off_t my_b_append_tell(IO_CACHE* info);
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
*(info)->current_pos)