diff options
Diffstat (limited to 'mysys/checksum.c')
-rw-r--r-- | mysys/checksum.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mysys/checksum.c b/mysys/checksum.c index 4f86f6845f0..0cc9801c2b1 100644 --- a/mysys/checksum.c +++ b/mysys/checksum.c @@ -18,6 +18,8 @@ #include <my_sys.h> #include <zlib.h> +ha_checksum my_crc_dbug_check= 1; /* Unlikely number */ + /* Calculate a long checksum for a memoryblock. @@ -34,9 +36,13 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) const uchar *end=pos+length; for ( ; pos != end ; pos++) crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8)); - return crc; #else - return (ha_checksum)crc32((uint)crc, pos, length); + crc= (ha_checksum) crc32((uint)crc, pos, length); +#endif /* NOT_USED */ + DBUG_PRINT("info", ("crc: %lu", (ulong) crc)); +#ifndef DBUG_OFF + if (crc == my_crc_dbug_check) + my_debug_put_break_here(); #endif + return crc; } - |