From bc84c905d5e3984f3b1c767772d0c8d8d0a1967f Mon Sep 17 00:00:00 2001 From: WinCPP Date: Sat, 3 Mar 2018 18:57:37 +0530 Subject: [PATCH] Issue #24343 Vector Ctor using Span --- .../ref/System.Numerics.Vectors.csproj | 10 ++++++---- .../src/System.Numerics.Vectors.csproj | 1 - .../tests/GenericVectorTests.cs | 5 ++--- .../tests/GenericVectorTests.tt | 16 +++++++++++++--- .../tests/System.Numerics.Vectors.Tests.csproj | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj b/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj index 5ac70e7e0522..7a37775f689f 100644 --- a/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj +++ b/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj @@ -3,8 +3,10 @@ {650277B5-9423-4ACE-BB54-2659995B21C7} - true - $(DefineConstants);netcoreapp + true + true + true + $(DefineConstants);netcoreapp @@ -23,14 +25,14 @@ - + - + diff --git a/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj b/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj index d72e3435765d..47a3bf9c341a 100644 --- a/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj +++ b/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj @@ -10,7 +10,6 @@ true true netstandard1.0;portable-net45+win8+wp8+wpa81 - $(DefineConstants);netcoreapp diff --git a/src/System.Numerics.Vectors/tests/GenericVectorTests.cs b/src/System.Numerics.Vectors/tests/GenericVectorTests.cs index e06cb36be623..1fa41f970eae 100644 --- a/src/System.Numerics.Vectors/tests/GenericVectorTests.cs +++ b/src/System.Numerics.Vectors/tests/GenericVectorTests.cs @@ -2699,12 +2699,11 @@ private static void ValidateVector(Vector vector, Action indexVali } } - internal static T[] GenerateRandomValuesForVector(int numValues = int.MinValue) where T : struct + internal static T[] GenerateRandomValuesForVector(int? numValues = null) where T : struct { int minValue = GetMinValue(); int maxValue = GetMaxValue(); - numValues = numValues == int.MinValue ? Vector.Count : numValues; - return Util.GenerateRandomValues(numValues, minValue, maxValue); + return Util.GenerateRandomValues(numValues ?? Vector.Count, minValue, maxValue); } internal static int GetMinValue() where T : struct diff --git a/src/System.Numerics.Vectors/tests/GenericVectorTests.tt b/src/System.Numerics.Vectors/tests/GenericVectorTests.tt index 67295b70b31b..43a36fc8b860 100644 --- a/src/System.Numerics.Vectors/tests/GenericVectorTests.tt +++ b/src/System.Numerics.Vectors/tests/GenericVectorTests.tt @@ -5,7 +5,7 @@ <#@ import namespace="System" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Runtime.InteropServices" #> -<#@ include file="..\src\System\Numerics\GenerationConfig.ttinclude" #><# GenerateCopyrightHeader(); #> +<#@ include file="..\..\common\src\corelib\System\Numerics\GenerationConfig.ttinclude" #><# GenerateCopyrightHeader(); #> using System; using System.Globalization; @@ -1792,11 +1792,11 @@ namespace System.Numerics.Tests } } - internal static T[] GenerateRandomValuesForVector() where T : struct + internal static T[] GenerateRandomValuesForVector(int? numValues = null) where T : struct { int minValue = GetMinValue(); int maxValue = GetMaxValue(); - return Util.GenerateRandomValues(Vector.Count, minValue, maxValue); + return Util.GenerateRandomValues(numValues ?? Vector.Count, minValue, maxValue); } internal static int GetMinValue() where T : struct @@ -1867,6 +1867,16 @@ namespace System.Numerics.Tests } throw new NotSupportedException(); } + + internal static T[] GetArrayOfDefaultValues(int count) + { + T[] arr = new T[count]; + for (int index = 0; index < count; ++index) + { + arr[index] = default(T); + } + return arr; + } #endregion } } diff --git a/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj b/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj index 42cbe76a3c8a..a79a3da3e2f5 100644 --- a/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj +++ b/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj @@ -35,7 +35,7 @@ System\MathF.netstandard.cs - + True True