Skip to content

Commit 7cae70b

Browse files
committed
Micro-optimization.
1 parent 2b6d2c6 commit 7cae70b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Cipher/AesCtrCryptoTransform.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, b
143143
const bool VECTORIZE = true;
144144
if (VECTORIZE)
145145
{ // vectorized xor
146-
int vectorLength = Vector<byte>.Count, vectorLimit = (fullBlockSize / vectorLength) * vectorLength;
147-
for (; i < vectorLimit; i += vectorLength)
146+
int vectorLength = Vector<byte>.Count, vectorLimit = fullBlockSize - vectorLength;
147+
for (; i <= vectorLimit; i += vectorLength)
148148
{
149149
var destVector = new Vector<byte>(outputBuffer, outputOffset + i);
150150
var leftVector = new Vector<byte>(inputBuffer, inputOffset + i);

0 commit comments

Comments
 (0)