summary refs log tree commit diff
path: root/crypto/src/util/Arrays.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/util/Arrays.cs')
-rw-r--r--crypto/src/util/Arrays.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs

index 784d45efb..78c4e8ffc 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs
@@ -467,6 +467,17 @@ namespace Org.BouncyCastle.Utilities return data == null ? null : (byte[])data.Clone(); } + public static short[] Clone(short[] data) + { + return data == null ? null : (short[])data.Clone(); + } + + [CLSCompliantAttribute(false)] + public static ushort[] Clone(ushort[] data) + { + return data == null ? null : (ushort[])data.Clone(); + } + public static int[] Clone(int[] data) { return data == null ? null : (int[])data.Clone(); @@ -694,6 +705,19 @@ namespace Org.BouncyCastle.Utilities return rv; } + public static ushort[] Concatenate(ushort[] a, ushort[] b) + { + if (a == null) + return Clone(b); + if (b == null) + return Clone(a); + + ushort[] rv = new ushort[a.Length + b.Length]; + Array.Copy(a, 0, rv, 0, a.Length); + Array.Copy(b, 0, rv, a.Length, b.Length); + return rv; + } + public static byte[] ConcatenateAll(params byte[][] vs) { byte[][] nonNull = new byte[vs.Length][];