File tree 2 files changed +26
-0
lines changed
src/mscorlib/shared/System/Numerics
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ using Internal . Runtime . CompilerServices ;
5
6
using System . Globalization ;
6
7
using System . Numerics . Hashing ;
7
8
using System . Runtime . CompilerServices ;
9
+ using System . Runtime . InteropServices ;
8
10
using System . Text ;
9
11
10
12
namespace System . Numerics
@@ -763,6 +765,17 @@ private Vector(ref Register existingRegister)
763
765
{
764
766
this . register = existingRegister ;
765
767
}
768
+
769
+ /// <summary>
770
+ /// Constructs a vector from the given span.
771
+ /// The span must contain at least Vector'T.Count elements.
772
+ /// </summary>
773
+ [ Intrinsic ]
774
+ public unsafe Vector ( Span < T > values )
775
+ : this ( )
776
+ {
777
+ this = Unsafe . ReadUnaligned < Vector < T > > ( ref Unsafe . As < T , byte > ( ref MemoryMarshal . GetReference ( values ) ) ) ;
778
+ }
766
779
#endregion Constructors
767
780
768
781
#region Public Instance Methods
Original file line number Diff line number Diff line change 7
7
<#@ import namespace="System.Runtime.InteropServices" #>
8
8
<#@ include file="GenerationConfig.ttinclude" #><# GenerateCopyrightHeader(); #>
9
9
10
+ using Internal.Runtime.CompilerServices;
10
11
using System.Globalization;
11
12
using System.Numerics.Hashing;
12
13
using System.Runtime.CompilerServices;
14
+ using System.Runtime.InteropServices;
13
15
using System.Text;
14
16
15
17
namespace System.Numerics
@@ -283,6 +285,17 @@ namespace System.Numerics
283
285
{
284
286
this.register = existingRegister;
285
287
}
288
+
289
+ /// <summary>
290
+ /// Constructs a vector from the given span.
291
+ /// The span must contain at least Vector'T.Count elements.
292
+ /// </summary>
293
+ [Intrinsic]
294
+ public unsafe Vector(Span<T> values)
295
+ : this()
296
+ {
297
+ this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
298
+ }
286
299
#endregion Constructors
287
300
288
301
#region Public Instance Methods
You can’t perform that action at this time.
0 commit comments