Use resizeArray instead of expand/shrinkArray

This commit is contained in:
Eugen Wissner 2016-12-13 10:57:12 +01:00
parent ab9f96e0c7
commit 54d0597657

View File

@ -60,21 +60,21 @@ body
final switch (mode) with (PaddingMode) final switch (mode) with (PaddingMode)
{ {
case zero: case zero:
allocator.expandArray(input, needed); allocator.resizeArray(input, input.length + needed);
break; break;
case pkcs7: case pkcs7:
if (needed) if (needed)
{ {
allocator.expandArray(input, needed); allocator.resizeArray(input, input.length + needed);
input[input.length - needed ..$].each!((ref e) => e = needed); input[input.length - needed ..$].each!((ref e) => e = needed);
} }
else else
{ {
allocator.expandArray(input, blockSize); allocator.resizeArray(input, input.length + blockSize);
} }
break; break;
case ansiX923: case ansiX923:
allocator.expandArray(input, needed ? needed : blockSize); allocator.resizeArray(input, input.length + (needed ? needed : blockSize));
input[$ - 1] = needed; input[$ - 1] = needed;
break; break;
} }
@ -220,7 +220,7 @@ body
case ansiX923: case ansiX923:
immutable last = input[$ - 1]; immutable last = input[$ - 1];
allocator.shrinkArray(input, last ? last : blockSize); allocator.resizeArray(input, input.length - (last ? last : blockSize));
break; break;
} }