diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2010-05-19 11:16:18 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2010-05-19 11:16:18 +0300 |
commit | 2bd4b5e2ab4007c9a8b57876ddddfd3f54276f1a (patch) | |
tree | 0072660c07341b6f9febbeac41ed03c7f4fa620a | |
parent | 973c59be48985c6523521e55d4f4f232a9258486 (diff) | |
download | mariadb-git-2bd4b5e2ab4007c9a8b57876ddddfd3f54276f1a.tar.gz |
Make UNIV_DEBUG Valgrind friendly in the built-in InnoDB.
Use | instead of +, and mask out the dont-care bits in debug assertions.
-rw-r--r-- | storage/innobase/include/mach0data.ic | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic index dc7918c287b..fceb8017121 100644 --- a/storage/innobase/include/mach0data.ic +++ b/storage/innobase/include/mach0data.ic @@ -19,7 +19,7 @@ mach_write_to_1( ulint n) /* in: ulint integer to be stored, >= 0, < 256 */ { ut_ad(b); - ut_ad(n <= 0xFFUL); + ut_ad((n | 0xFFUL) <= 0xFFUL); b[0] = (byte)n; } @@ -48,7 +48,7 @@ mach_write_to_2( ulint n) /* in: ulint integer to be stored */ { ut_ad(b); - ut_ad(n <= 0xFFFFUL); + ut_ad((n | 0xFFFFUL) <= 0xFFFFUL); b[0] = (byte)(n >> 8); b[1] = (byte)(n); @@ -64,10 +64,7 @@ mach_read_from_2( /* out: ulint integer */ byte* b) /* in: pointer to 2 bytes */ { - ut_ad(b); - return( ((ulint)(b[0]) << 8) - + (ulint)(b[1]) - ); + return(((ulint)(b[0]) << 8) | (ulint)(b[1])); } /************************************************************ @@ -112,7 +109,7 @@ mach_write_to_3( ulint n) /* in: ulint integer to be stored */ { ut_ad(b); - ut_ad(n <= 0xFFFFFFUL); + ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL); b[0] = (byte)(n >> 16); b[1] = (byte)(n >> 8); @@ -131,8 +128,8 @@ mach_read_from_3( { ut_ad(b); return( ((ulint)(b[0]) << 16) - + ((ulint)(b[1]) << 8) - + (ulint)(b[2]) + | ((ulint)(b[1]) << 8) + | (ulint)(b[2]) ); } @@ -166,9 +163,9 @@ mach_read_from_4( { ut_ad(b); return( ((ulint)(b[0]) << 24) - + ((ulint)(b[1]) << 16) - + ((ulint)(b[2]) << 8) - + (ulint)(b[3]) + | ((ulint)(b[1]) << 16) + | ((ulint)(b[2]) << 8) + | (ulint)(b[3]) ); } @@ -670,7 +667,7 @@ mach_read_from_2_little_endian( /* out: unsigned long int */ byte* buf) /* in: from where to read */ { - return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256); + return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8)); } /************************************************************* |