Unwrap the loop in the WAL hash function.

FossilOrigin-Name: eb94ae13206762a42ddad12e0d1461df83e9759e44a369f188cd3aad82f211c4
This commit is contained in:
drh 2023-04-12 20:23:03 +00:00
parent be0023faba
commit 3f4a319934
3 changed files with 34 additions and 13 deletions

View File

@ -1,5 +1,5 @@
C Automatically\sset\sHAVE_PREAD\sand\sHAVE_PWRITE\son\slinux,\sas\shas\sbeen\sdone\sin\nMacOS\sfor\sa\slong\stime\snow.
D 2023-04-12T19:40:00.840
C Unwrap\sthe\sloop\sin\sthe\sWAL\shash\sfunction.
D 2023-04-12T20:23:03.475
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -707,7 +707,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8
F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac
F src/vtab.c 4a1b231b5938de0282fbb605eb068ca673a1b6a383130f54d1bcbbac951988ad
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
F src/wal.c 3f4ac276a60bda76f9f1f6f1c2c38599bacd4987e5efcd3f7fed2647bf97280a
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
F src/where.c ef9e644d1d76e86f68c941eb05d30a98fc0811eeef2a110906d81fedde81b6bf
@ -2052,8 +2052,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P cfb3dba9b015ce7a75857978bfd2540b4d5be985d9d2ec4a5842b3089ed3da60
R a27797e00df587d05c58ecedf6ed69c3
P 2f7a36d2c374100019bd9d38aea51ea10cfcf9b1f0330ba084a75f0773df8ebf
R 0a0fe6e09d894bc0529190e100b44f7b
U drh
Z 0702655698bfbb6d67bb8fe5728ec984
Z 3c22931f459153fffc356af79809978d
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
2f7a36d2c374100019bd9d38aea51ea10cfcf9b1f0330ba084a75f0773df8ebf
eb94ae13206762a42ddad12e0d1461df83e9759e44a369f188cd3aad82f211c4

View File

@ -746,19 +746,40 @@ static void walChecksumBytes(
assert( nByte>=8 );
assert( (nByte&0x00000007)==0 );
assert( nByte<=65536 );
assert( nByte%4==0 );
if( nativeCksum ){
do {
s1 += *aData++ + s2;
s2 += *aData++ + s1;
}while( aData<aEnd );
}else{
if( !nativeCksum ){
do {
s1 += BYTESWAP32(aData[0]) + s2;
s2 += BYTESWAP32(aData[1]) + s1;
aData += 2;
}while( aData<aEnd );
}else if( nByte%64==0 ){
do {
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
s1 += *aData++ + s2;
s2 += *aData++ + s1;
}while( aData<aEnd );
}else{
do {
s1 += *aData++ + s2;
s2 += *aData++ + s1;
}while( aData<aEnd );
}
assert( aData==aEnd );
aOut[0] = s1;
aOut[1] = s2;