#At file:///home/mysql_src/bzrrepos/mysql-next-mr-opt-backporting2/ based on revid:epotemkin@stripped
3159 Guilhem Bichot 2010-05-10
Backport of a little bit of guilhem@stripped:
likely() had an implicit cast to long, which loses bits when likely(ulonglong)
or likely(pointer) and has proved to cause bugs.
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2010-02-25 12:23:43 +0000
+++ b/include/my_global.h 2010-05-10 09:10:42 +0000
@@ -227,9 +227,14 @@
#define __builtin_expect(x, expected_value) (x)
-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
+ The semantics of builtin_expect() are that
+ 1) its two arguments are long
+ 2) it's likely that they are ==
+ Those of our likely(x) are that x can be bool/int/longlong/pointer.
+#define likely(x) __builtin_expect(((x) != 0),1)
+#define unlikely(x) __builtin_expect(((x) != 0),0)
The macros below are useful in optimising places where it has been
Attachment: [text/bzr-bundle] firstname.lastname@example.org
|• bzr commit into mysql-next-mr-bugfixing branch (guilhem:3159) ||Guilhem Bichot||14 May|