mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 23:12:18 +02:00
fix error in QuickXorHash implementation
This commit is contained in:
parent
974be0884b
commit
1581c6989a
|
@ -19,11 +19,11 @@ struct QuickXor
|
|||
{
|
||||
int vectorArrayIndex = _shiftSoFar / 64;
|
||||
int vectorOffset = _shiftSoFar % 64;
|
||||
size_t iterations = min(array.length, widthInBits);
|
||||
immutable size_t iterations = min(array.length, widthInBits);
|
||||
|
||||
for (size_t i = 0; i < iterations; i++) {
|
||||
bool isLastCell = vectorArrayIndex == _data.length - 1;
|
||||
int bitsInVectorCell = isLastCell ? bitsInLastCell : 64;
|
||||
immutable bool isLastCell = vectorArrayIndex == _data.length - 1;
|
||||
immutable int bitsInVectorCell = isLastCell ? bitsInLastCell : 64;
|
||||
|
||||
if (vectorOffset <= bitsInVectorCell - 8) {
|
||||
for (size_t j = i; j < array.length; j += widthInBits) {
|
||||
|
@ -50,7 +50,7 @@ struct QuickXor
|
|||
}
|
||||
}
|
||||
|
||||
_shiftSoFar += (_shiftSoFar + shift * array.length) % widthInBits;
|
||||
_shiftSoFar = cast(int) (_shiftSoFar + shift * (array.length % widthInBits)) % widthInBits;
|
||||
_lengthSoFar += array.length;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue