diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-20 18:40:56 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-20 18:40:56 +0700 |
commit | 758b05345c9d2f0b412f75435cb31231a7f70311 (patch) | |
tree | 5600970e299bc813a44ee48d2e3c8ba8eca9572d /crypto/src/util | |
parent | BigInteger construction from little-endian (diff) | |
download | BouncyCastle.NET-ed25519-758b05345c9d2f0b412f75435cb31231a7f70311.tar.xz |
Refactoring: reduced allocations
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/Arrays.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index 83fafb388..f99065512 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -958,6 +958,15 @@ namespace Org.BouncyCastle.Utilities return result; } + internal static void Reverse<T>(T[] input, T[] output) + { + int last = input.Length - 1; + for (int i = 0; i <= last; ++i) + { + output[i] = input[last - i]; + } + } + public static T[] ReverseInPlace<T>(T[] array) { if (null == array) |