summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-08-09 20:46:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-08-09 20:46:24 +0700
commit1e57ab230bdfe4dd18b6f56986113a2bf2ee1805 (patch)
tree9307c9f1f501929223a5640c585e7f71255c5540 /crypto/src
parentLoosen test requirements on error message (diff)
downloadBouncyCastle.NET-ed25519-1e57ab230bdfe4dd18b6f56986113a2bf2ee1805.tar.xz
Add Clone for bool[]
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/util/Arrays.cs51
1 files changed, 21 insertions, 30 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs
index 5d62d7174..7b060bf3c 100644
--- a/crypto/src/util/Arrays.cs
+++ b/crypto/src/util/Arrays.cs
@@ -366,35 +366,23 @@ namespace Org.BouncyCastle.Utilities
             return hc;
         }
 
-        public static byte[] Clone(
-            byte[] data)
+        public static bool[] Clone(bool[] data)
         {
-            return data == null ? null : (byte[])data.Clone();
+            return data == null ? null : (bool[])data.Clone();
         }
 
-        public static byte[] Clone(
-            byte[] data, 
-            byte[] existing)
+        public static byte[] Clone(byte[] data)
         {
-            if (data == null)
-            {
-                return null;
-            }
-            if ((existing == null) || (existing.Length != data.Length))
-            {
-                return Clone(data);
-            }
-            Array.Copy(data, 0, existing, 0, existing.Length);
-            return existing;
+            return data == null ? null : (byte[])data.Clone();
         }
 
-        public static int[] Clone(
-            int[] data)
+        public static int[] Clone(int[] data)
         {
             return data == null ? null : (int[])data.Clone();
         }
 
-        internal static uint[] Clone(uint[] data)
+        [CLSCompliantAttribute(false)]
+        public static uint[] Clone(uint[] data)
         {
             return data == null ? null : (uint[])data.Clone();
         }
@@ -405,25 +393,28 @@ namespace Org.BouncyCastle.Utilities
         }
 
         [CLSCompliantAttribute(false)]
-        public static ulong[] Clone(
-            ulong[] data)
+        public static ulong[] Clone(ulong[] data)
         {
-            return data == null ? null : (ulong[]) data.Clone();
+            return data == null ? null : (ulong[])data.Clone();
+        }
+
+        public static byte[] Clone(byte[] data, byte[] existing)
+        {
+            if (data == null)
+                return null;
+            if (existing == null || existing.Length != data.Length)
+                return Clone(data);
+            Array.Copy(data, 0, existing, 0, existing.Length);
+            return existing;
         }
 
         [CLSCompliantAttribute(false)]
-        public static ulong[] Clone(
-            ulong[] data, 
-            ulong[] existing)
+        public static ulong[] Clone(ulong[] data, ulong[] existing)
         {
             if (data == null)
-            {
                 return null;
-            }
-            if ((existing == null) || (existing.Length != data.Length))
-            {
+            if (existing == null || existing.Length != data.Length)
                 return Clone(data);
-            }
             Array.Copy(data, 0, existing, 0, existing.Length);
             return existing;
         }