Skip to content

Commit

Permalink
Micro-optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrapkin committed Jan 9, 2019
1 parent 2b6d2c6 commit 7cae70b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cipher/AesCtrCryptoTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, b
const bool VECTORIZE = true;
if (VECTORIZE)
{ // vectorized xor
int vectorLength = Vector<byte>.Count, vectorLimit = (fullBlockSize / vectorLength) * vectorLength;
for (; i < vectorLimit; i += vectorLength)
int vectorLength = Vector<byte>.Count, vectorLimit = fullBlockSize - vectorLength;
for (; i <= vectorLimit; i += vectorLength)
{
var destVector = new Vector<byte>(outputBuffer, outputOffset + i);
var leftVector = new Vector<byte>(inputBuffer, inputOffset + i);
Expand Down

0 comments on commit 7cae70b

Please sign in to comment.