summary refs log tree commit diff
path: root/crypto/src/math/raw
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-24 16:04:27 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-24 16:04:27 +0700
commit0852874c0f212c00c74fa3292b92dfb557993842 (patch)
tree1986c8f8503c3e14fe69d708afd73348e83f3a28 /crypto/src/math/raw
parentUse platform compression where available (diff)
downloadBouncyCastle.NET-ed25519-0852874c0f212c00c74fa3292b92dfb557993842.tar.xz
Use MemoryMarshal.AsBytes
Diffstat (limited to 'crypto/src/math/raw')
-rw-r--r--crypto/src/math/raw/Nat256.cs12
-rw-r--r--crypto/src/math/raw/Nat512.cs12
2 files changed, 12 insertions, 12 deletions
diff --git a/crypto/src/math/raw/Nat256.cs b/crypto/src/math/raw/Nat256.cs
index 086ba53b1..47e0644f6 100644
--- a/crypto/src/math/raw/Nat256.cs
+++ b/crypto/src/math/raw/Nat256.cs
@@ -1391,9 +1391,9 @@ namespace Org.BouncyCastle.Math.Raw
 #if NETCOREAPP3_0_OR_GREATER
             if (Avx2.IsSupported && Unsafe.SizeOf<Vector256<byte>>() == 32)
             {
-                var X = MemoryMarshal.Cast<uint, byte>(x[..8]);
-                var Y = MemoryMarshal.Cast<uint, byte>(y[..8]);
-                var Z = MemoryMarshal.Cast<uint, byte>(z[..8]);
+                var X = MemoryMarshal.AsBytes(x[..8]);
+                var Y = MemoryMarshal.AsBytes(y[..8]);
+                var Z = MemoryMarshal.AsBytes(z[..8]);
 
                 var X0 = MemoryMarshal.Read<Vector256<byte>>(X[0x00..0x20]);
                 var Y0 = MemoryMarshal.Read<Vector256<byte>>(Y[0x00..0x20]);
@@ -1406,9 +1406,9 @@ namespace Org.BouncyCastle.Math.Raw
 
             if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == 16)
             {
-                var X = MemoryMarshal.Cast<uint, byte>(x[..8]);
-                var Y = MemoryMarshal.Cast<uint, byte>(y[..8]);
-                var Z = MemoryMarshal.Cast<uint, byte>(z[..8]);
+                var X = MemoryMarshal.AsBytes(x[..8]);
+                var Y = MemoryMarshal.AsBytes(y[..8]);
+                var Z = MemoryMarshal.AsBytes(z[..8]);
 
                 var X0 = MemoryMarshal.Read<Vector128<byte>>(X[0x00..0x10]);
                 var X1 = MemoryMarshal.Read<Vector128<byte>>(X[0x10..0x20]);
diff --git a/crypto/src/math/raw/Nat512.cs b/crypto/src/math/raw/Nat512.cs
index 37cf0b6ff..d94ae40da 100644
--- a/crypto/src/math/raw/Nat512.cs
+++ b/crypto/src/math/raw/Nat512.cs
@@ -69,9 +69,9 @@ namespace Org.BouncyCastle.Math.Raw
 #if NETCOREAPP3_0_OR_GREATER
             if (Avx2.IsSupported && Unsafe.SizeOf<Vector256<byte>>() == 32)
             {
-                var X = MemoryMarshal.Cast<uint, byte>(x[..16]);
-                var Y = MemoryMarshal.Cast<uint, byte>(y[..16]);
-                var Z = MemoryMarshal.Cast<uint, byte>(z[..16]);
+                var X = MemoryMarshal.AsBytes(x[..16]);
+                var Y = MemoryMarshal.AsBytes(y[..16]);
+                var Z = MemoryMarshal.AsBytes(z[..16]);
 
                 var X0 = MemoryMarshal.Read<Vector256<byte>>(X[0x00..0x20]);
                 var X1 = MemoryMarshal.Read<Vector256<byte>>(X[0x20..0x40]);
@@ -89,9 +89,9 @@ namespace Org.BouncyCastle.Math.Raw
 
             if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == 16)
             {
-                var X = MemoryMarshal.Cast<uint, byte>(x[..16]);
-                var Y = MemoryMarshal.Cast<uint, byte>(y[..16]);
-                var Z = MemoryMarshal.Cast<uint, byte>(z[..16]);
+                var X = MemoryMarshal.AsBytes(x[..16]);
+                var Y = MemoryMarshal.AsBytes(y[..16]);
+                var Z = MemoryMarshal.AsBytes(z[..16]);
 
                 var X0 = MemoryMarshal.Read<Vector128<byte>>(X[0x00..0x10]);
                 var X1 = MemoryMarshal.Read<Vector128<byte>>(X[0x10..0x20]);