Skip to content

Commit 10b18c0

Browse files
authored
Update SpookyHash to fully use Span
Signed-off-by: Xen <lordofxen@deskasoft.com>
1 parent 13e7d7d commit 10b18c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

HashifyNet/Algorithms/SpookyHash/SpookyHashV1_Implementation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected override void TransformByteGroupsInternal(ReadOnlySpan<byte> data)
185185

186186
if (_shortHashBuffer != null)
187187
{
188-
Mix(_hashValue, new ArraySegment<byte>(_shortHashBuffer, 0, _bytesProcessed));
188+
Mix(_hashValue, _shortHashBuffer.AsSpan(0, _bytesProcessed));
189189

190190
_shortHashBuffer = null;
191191
}
@@ -212,7 +212,7 @@ protected override IHashValue FinalizeHashValueInternal(ReadOnlySpan<byte> lefto
212212

213213
finalMixBuffer[95] = (byte)remainderCount;
214214

215-
Mix(finalHashValue, new ArraySegment<byte>(finalMixBuffer, 0, 96));
215+
Mix(finalHashValue, finalMixBuffer.AsSpan(0, finalMixBuffer.Length));
216216
End(finalHashValue);
217217

218218
switch (_hashSizeInBits)
@@ -438,4 +438,4 @@ private static ulong RotateLeft(ulong operand, int shiftCount)
438438
}
439439
}
440440
}
441-
}
441+
}

0 commit comments

Comments
 (0)