summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorserg@serg.mylan <>2003-08-05 21:14:15 +0200
committerserg@serg.mylan <>2003-08-05 21:14:15 +0200
commit79922d946ac7c7c9c77c10fd7f831f14f2a9892c (patch)
tree7f824b71d5779659b28c60ef72d0b119daa9ccf9 /mysys
parent6ac0c55c103685c9e4bcd76080a5d5cb428c6130 (diff)
downloadmariadb-git-79922d946ac7c7c9c77c10fd7f831f14f2a9892c.tar.gz
table checksum background:
my_checksum() mysys function NISAM checksum code moved from mysys to isam/ - it's obsolete MyISAM checksum code moved to mysys table's checksum accessible from sql layer SHOW TABLE STATUS shows checksum (WL#646) code cleanup
Diffstat (limited to 'mysys')
-rw-r--r--mysys/checksum.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/mysys/checksum.c b/mysys/checksum.c
index 1dd135c7ad9..2ae139b81c3 100644
--- a/mysys/checksum.c
+++ b/mysys/checksum.c
@@ -19,19 +19,20 @@
#include "my_sys.h"
/*
- Calculate a long checksum for a memoryblock. Used to verify pack_isam
-
+ Calculate a long checksum for a memoryblock.
+
SYNOPSIS
- checksum()
- mem Pointer to memory block
- count Count of bytes
+ my_checksum()
+ crc start value for crc
+ pos pointer to memory block
+ length length of the block
*/
-ulong checksum(const byte *mem, uint count)
+ha_checksum my_checksum(ha_checksum crc, const byte *pos, uint length)
{
- ulong crc;
- for (crc= 0; count-- ; mem++)
- crc= ((crc << 1) + *((uchar*) mem)) +
- test(crc & ((ulong) 1L << (8*sizeof(ulong)-1)));
+ const byte *end=pos+length;
+ for ( ; pos != end ; pos++)
+ crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8));
return crc;
}
+