Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@@ -1,66 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors.Tests", "tests\System.Numerics.Vectors.Tests.csproj", "{99E1E564-0EF4-4E33-BECE-8ABE64771349}"
ProjectSection(ProjectDependencies) = postProject
{53134B0C-0D57-481B-B84E-D1991E8D54FF} = {53134B0C-0D57-481B-B84E-D1991E8D54FF}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors.Performance.Tests", "tests\Performance\System.Numerics.Vectors.Performance.Tests.csproj", "{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}"
ProjectSection(ProjectDependencies) = postProject
{53134B0C-0D57-481B-B84E-D1991E8D54FF} = {53134B0C-0D57-481B-B84E-D1991E8D54FF}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors.Tests", "tests\System.Numerics.Vectors.Tests.csproj", "{A7074928-82C3-4739-88FE-9B528977950C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors", "src\System.Numerics.Vectors.csproj", "{53134B0C-0D57-481B-B84E-D1991E8D54FF}"
ProjectSection(ProjectDependencies) = postProject
{53134B0C-0D57-481B-B84E-D1991E8D54FF} = {53134B0C-0D57-481B-B84E-D1991E8D54FF}
{650277B5-9423-4ACE-BB54-2659995B21C7} = {650277B5-9423-4ACE-BB54-2659995B21C7}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors", "src\System.Numerics.Vectors.csproj", "{53134B0C-0D57-481B-B84E-D1991E8D54FF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors", "ref\System.Numerics.Vectors.csproj", "{650277B5-9423-4ACE-BB54-2659995B21C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{079846CE-A984-41BC-88AB-1ED6C5CD2FF7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Numerics.Vectors", "ref\System.Numerics.Vectors.csproj", "{CCC4439F-D0A8-4325-B8F2-0EEFA2CCB229}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CD0BD3C8-F867-4FEE-AB31-4DCA01FC8A30}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A86D6523-CA0C-4C1C-BFE7-D35564945C0B}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU
ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net46-Windows_NT-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.DebugNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = net46-Windows_NT-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net46-Windows_NT-Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp|AnyCPU.Build.0 = net46-Windows_NT-Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{99E1E564-0EF4-4E33-BECE-8ABE64771349}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{99E1E564-0EF4-4E33-BECE-8ABE64771349}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{99E1E564-0EF4-4E33-BECE-8ABE64771349}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{99E1E564-0EF4-4E33-BECE-8ABE64771349}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9}.Release|Any CPU.Build.0 = Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{53134B0C-0D57-481B-B84E-D1991E8D54FF}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{650277B5-9423-4ACE-BB54-2659995B21C7}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{650277B5-9423-4ACE-BB54-2659995B21C7}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{650277B5-9423-4ACE-BB54-2659995B21C7}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{650277B5-9423-4ACE-BB54-2659995B21C7}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9} = {D9906F1A-A41A-43CD-81D2-BA94CF0001C9}
{53134B0C-0D57-481B-B84E-D1991E8D54FF} = {53134B0C-0D57-481B-B84E-D1991E8D54FF}
{99E1E564-0EF4-4E33-BECE-8ABE64771349} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{D9906F1A-A41A-43CD-81D2-BA94CF0001C9} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{53134B0C-0D57-481B-B84E-D1991E8D54FF} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
{650277B5-9423-4ACE-BB54-2659995B21C7} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
EndGlobalSection
EndGlobal

View File

@@ -4,5 +4,7 @@
<PropertyGroup>
<AssemblyVersion>4.1.3.0</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
<IsDesktopFacade>true</IsDesktopFacade>
<IsUAP>true</IsUAP>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<!-- we need to be supported on pre-nuget-3 platforms (Dev12, Dev11, etc) -->
<MinClientVersion>2.8.6</MinClientVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ref\System.Numerics.Vectors.csproj">
<SupportedFramework>net45;netcore45;wp8;wpa81;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
<!-- Make sure this doesn't get stripped during harvesting.
We have an implementation that will work on desktop, thus needs a unique assembly version -->
<Preserve>true</Preserve>
</ProjectReference>
<ProjectReference Include="..\src\System.Numerics.Vectors.csproj" />
</ItemGroup>
<ItemGroup>
<InboxOnTargetFramework Include="netstandard2.0" />
<InboxOnTargetFramework Include="netcoreapp2.0" />
<InboxOnTargetFramework Include="MonoAndroid10" />
<InboxOnTargetFramework Include="MonoTouch10" />
<InboxOnTargetFramework Include="xamarinios10" />
<InboxOnTargetFramework Include="xamarinmac20" />
<InboxOnTargetFramework Include="xamarintvos10" />
<InboxOnTargetFramework Include="xamarinwatchos10" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageConfigurations>
netstandard1.0;
netstandard;
</PackageConfigurations>
<BuildConfigurations>
netcoreapp;
uap;
netfx;
net46;
$(PackageConfigurations);
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -217,6 +217,18 @@ namespace System.Numerics
public static System.Numerics.Vector<float> ConditionalSelect(System.Numerics.Vector<int> condition, System.Numerics.Vector<float> left, System.Numerics.Vector<float> right) { throw null; }
public static System.Numerics.Vector<double> ConditionalSelect(System.Numerics.Vector<long> condition, System.Numerics.Vector<double> left, System.Numerics.Vector<double> right) { throw null; }
public static System.Numerics.Vector<T> ConditionalSelect<T>(System.Numerics.Vector<T> condition, System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
public static System.Numerics.Vector<float> ConvertToSingle(System.Numerics.Vector<int> value) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<float> ConvertToSingle(System.Numerics.Vector<uint> value) { throw null; }
public static System.Numerics.Vector<int> ConvertToInt32(System.Numerics.Vector<float> value) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<uint> ConvertToUInt32(System.Numerics.Vector<float> value) { throw null; }
public static System.Numerics.Vector<double> ConvertToDouble(System.Numerics.Vector<long> value) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<double> ConvertToDouble(System.Numerics.Vector<ulong> value) { throw null; }
public static System.Numerics.Vector<long> ConvertToInt64(System.Numerics.Vector<double> value) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<ulong> ConvertToUInt64(System.Numerics.Vector<double> value) { throw null; }
public static System.Numerics.Vector<T> Divide<T>(System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
public static T Dot<T>(System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
public static System.Numerics.Vector<long> Equals(System.Numerics.Vector<double> left, System.Numerics.Vector<double> right) { throw null; }
@@ -259,10 +271,32 @@ namespace System.Numerics
public static System.Numerics.Vector<T> Multiply<T>(T left, System.Numerics.Vector<T> right) where T : struct { throw null; }
public static System.Numerics.Vector<T> Multiply<T>(System.Numerics.Vector<T> left, T right) where T : struct { throw null; }
public static System.Numerics.Vector<T> Multiply<T>(System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<byte> Narrow(System.Numerics.Vector<ushort> source1, System.Numerics.Vector<ushort> source2) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<ushort> Narrow(System.Numerics.Vector<uint> source1, System.Numerics.Vector<uint> source2) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<uint> Narrow(System.Numerics.Vector<ulong> source1, System.Numerics.Vector<ulong> source2) { throw null; }
[System.CLSCompliant(false)]
public static System.Numerics.Vector<sbyte> Narrow(System.Numerics.Vector<short> source1, System.Numerics.Vector<short> source2) { throw null; }
public static System.Numerics.Vector<short> Narrow(System.Numerics.Vector<int> source1, System.Numerics.Vector<int> source2) { throw null; }
public static System.Numerics.Vector<int> Narrow(System.Numerics.Vector<long> source1, System.Numerics.Vector<long> source2) { throw null; }
public static System.Numerics.Vector<float> Narrow(System.Numerics.Vector<double> source1, System.Numerics.Vector<double> source2) { throw null; }
public static System.Numerics.Vector<T> Negate<T>(System.Numerics.Vector<T> value) where T : struct { throw null; }
public static System.Numerics.Vector<T> OnesComplement<T>(System.Numerics.Vector<T> value) where T : struct { throw null; }
public static System.Numerics.Vector<T> SquareRoot<T>(System.Numerics.Vector<T> value) where T : struct { throw null; }
public static System.Numerics.Vector<T> Subtract<T>(System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
[System.CLSCompliant(false)]
public static void Widen(System.Numerics.Vector<byte> source, out System.Numerics.Vector<ushort> dest1, out System.Numerics.Vector<ushort> dest2) { dest1 = default(System.Numerics.Vector<ushort>); dest2 = default(System.Numerics.Vector<ushort>); }
[System.CLSCompliant(false)]
public static void Widen(System.Numerics.Vector<ushort> source, out System.Numerics.Vector<uint> dest1, out System.Numerics.Vector<uint> dest2) { dest1 = default(System.Numerics.Vector<uint>); dest2 = default(System.Numerics.Vector<uint>); }
[System.CLSCompliant(false)]
public static void Widen(System.Numerics.Vector<uint> source, out System.Numerics.Vector<ulong> dest1, out System.Numerics.Vector<ulong> dest2) { dest1 = default(System.Numerics.Vector<ulong>); dest2 = default(System.Numerics.Vector<ulong>); }
[System.CLSCompliant(false)]
public static void Widen(System.Numerics.Vector<sbyte> source, out System.Numerics.Vector<short> dest1, out System.Numerics.Vector<short> dest2) { dest1 = default(System.Numerics.Vector<short>); dest2 = default(System.Numerics.Vector<short>); }
public static void Widen(System.Numerics.Vector<short> source, out System.Numerics.Vector<int> dest1, out System.Numerics.Vector<int> dest2) { dest1 = default(System.Numerics.Vector<int>); dest2 = default(System.Numerics.Vector<int>); }
public static void Widen(System.Numerics.Vector<int> source, out System.Numerics.Vector<long> dest1, out System.Numerics.Vector<long> dest2) { dest1 = default(System.Numerics.Vector<long>); dest2 = default(System.Numerics.Vector<long>); }
public static void Widen(System.Numerics.Vector<float> source, out System.Numerics.Vector<double> dest1, out System.Numerics.Vector<double> dest2) { dest1 = default(System.Numerics.Vector<double>); dest2 = default(System.Numerics.Vector<double>); }
public static System.Numerics.Vector<T> Xor<T>(System.Numerics.Vector<T> left, System.Numerics.Vector<T> right) where T : struct { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]

View File

@@ -1,14 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{650277B5-9423-4ACE-BB54-2659995B21C7}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Numerics.Vectors.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx' OR '$(TargetGroup)' == 'net46'">
<Reference Include="mscorlib" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard1.0'">
<Reference Include="System.Runtime" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'uap'">
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View File

@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageConfigurations>
netstandard1.0;
netstandard;
net46;
</PackageConfigurations>
<BuildConfigurations>
net46-Windows_NT;
uap-Windows_NT;
netfx-Windows_NT;
netcoreapp;
$(PackageConfigurations)
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -1,64 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
@@ -123,19 +64,10 @@
<data name="Arg_ElementsInSourceIsGreaterThanDestination" xml:space="preserve">
<value>Number of elements in source vector is greater than the destination array</value>
</data>
<data name="Arg_MultiDimArrayNotSupported" xml:space="preserve">
<value>Only one-dimensional arrays are supported</value>
</data>
<data name="Arg_NullArgumentNullRef" xml:space="preserve">
<value>The method was called with a null array argument.</value>
</data>
<data name="Arg_RegisterLengthOfRangeException" xml:space="preserve">
<value>length must be less than</value>
</data>
<data name="Arg_TypeNotSupported" xml:space="preserve">
<value>Specified type is not supported</value>
</data>
<data name="Reflection_MethodNotSupported" xml:space="preserve">
<value>Vector&lt;T&gt;.Count cannot be called via reflection when intrinsics are enabled.</value>
</data>
</root>

View File

@@ -4,26 +4,33 @@
<PropertyGroup>
<ProjectGuid>{53134B0C-0D57-481B-B84E-D1991E8D54FF}</ProjectGuid>
<RootNamespace>System.Numerics</RootNamespace>
<AssemblyName>System.Numerics.Vectors</AssemblyName>
<DocumentationFile>$(OutputPath)System.Numerics.Vectors.xml</DocumentationFile>
<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netcoreapp'">netcoreapp;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='netfx' OR '$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.0'">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard1.0'">
<!-- Use the documentation file generated by this project for the reference assembly.
This needs to be kept in sync with all of the PackageTargetFrameworks used by
the reference assembly projects. -->
<FilesToPackage Include="$(DocumentationFile)">
<TargetPath>ref/netcoreapp</TargetPath>
<TargetPath>ref/netstandard1.0</TargetPath>
<IsReferenceAsset>true</IsReferenceAsset>
</FilesToPackage>
</ItemGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net46-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net46-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
<!-- Shared -->
<ItemGroup>
<Compile Include="..\..\Common\src\System\Numerics\Hashing\HashHelpers.cs">
@@ -47,8 +54,12 @@
</Compile>
<Compile Include="System\Numerics\Vector_Operations.cs" />
</ItemGroup>
<!-- Carry a copy of MathF where not available -->
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true' OR $(TargetGroup.StartsWith('netstandard'))">
<Compile Include="System\MathF.cs" />
</ItemGroup>
<!-- Portable version only -->
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<Compile Include="System\Numerics\Matrix3x2.cs" />
<Compile Include="System\Numerics\Matrix4x4.cs" />
<Compile Include="System\Numerics\Plane.cs" />
@@ -60,9 +71,9 @@
<Compile Include="System\Numerics\Vector4.cs" />
<Compile Include="System\Numerics\Vector4_Intrinsics.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'=='net46'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System.Numerics" />
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="mscorlib" />
<Reference Include="System.Numerics" />
</ItemGroup>
<ItemGroup>
<None Include="System\Numerics\GenerationConfig.ttinclude" />
@@ -85,5 +96,8 @@
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -0,0 +1,55 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.CompilerServices;
namespace System
{
internal static class MathF
{
public const float PI = (float)Math.PI;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Abs(float x)
{
return Math.Abs(x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Acos(float x)
{
return (float)Math.Acos(x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Cos(float x)
{
return (float)Math.Cos(x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float IEEERemainder(float x, float y)
{
return (float)Math.IEEERemainder(x, y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Sin(float x)
{
return (float)Math.Sin(x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Sqrt(float x)
{
return (float)Math.Sqrt(x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Tan(float x)
{
return (float)Math.Tan(x);
}
}
}

View File

@@ -47,6 +47,84 @@
return totalSize / Marshal.SizeOf(t);
}
public static HashSet<Type> WidenableTypes { get; private set; } = new HashSet<Type>()
{
typeof(byte),
typeof(ushort),
typeof(uint),
typeof(sbyte),
typeof(short),
typeof(int),
typeof(float),
};
private static Dictionary<Type, Type> s_widenTargets = new Dictionary<Type, Type>()
{
{ typeof(byte), typeof(ushort) },
{ typeof(ushort), typeof(uint) },
{ typeof(uint), typeof(ulong) },
{ typeof(sbyte), typeof(short) },
{ typeof(short), typeof(int) },
{ typeof(int), typeof(long) },
{ typeof(float), typeof(double) },
};
public Type GetWidenTarget(Type t)
{
Type target;
if (!s_widenTargets.TryGetValue(t, out target))
{
throw new InvalidOperationException("No widen target for " + t.Name);
}
return target;
}
public static HashSet<Type> NarrowableTypes { get; private set; } = new HashSet<Type>()
{
typeof(ushort),
typeof(uint),
typeof(ulong),
typeof(short),
typeof(int),
typeof(long),
typeof(double),
};
private static Dictionary<Type, Type> s_narrowTargets = new Dictionary<Type, Type>()
{
{ typeof(ulong), typeof(uint) },
{ typeof(uint), typeof(ushort) },
{ typeof(ushort), typeof(byte) },
{ typeof(long), typeof(int) },
{ typeof(int), typeof(short) },
{ typeof(short), typeof(sbyte) },
{ typeof(double), typeof(float) },
};
public Type GetNarrowTarget(Type t)
{
Type target;
if (!s_narrowTargets.TryGetValue(t, out target))
{
throw new InvalidOperationException("No narrow target for " + t.Name);
}
return target;
}
public static List<KeyValuePair<Type, Type>> SameSizeConversionPairs = new List<KeyValuePair<Type, Type>>()
{
new KeyValuePair<Type, Type>(typeof(int), typeof(float)),
new KeyValuePair<Type, Type>(typeof(uint), typeof(float)),
new KeyValuePair<Type, Type>(typeof(long), typeof(double)),
new KeyValuePair<Type, Type>(typeof(ulong), typeof(double)),
new KeyValuePair<Type, Type>(typeof(float), typeof(int)),
new KeyValuePair<Type, Type>(typeof(float), typeof(uint)),
new KeyValuePair<Type, Type>(typeof(double), typeof(long)),
new KeyValuePair<Type, Type>(typeof(double), typeof(ulong)),
};
public void GenerateCopyrightHeader()
{
#>// Licensed to the .NET Foundation under one or more agreements.

View File

@@ -278,8 +278,8 @@ namespace System.Numerics
{
Matrix3x2 result;
float xTan = (float)Math.Tan(radiansX);
float yTan = (float)Math.Tan(radiansY);
float xTan = MathF.Tan(radiansX);
float yTan = MathF.Tan(radiansY);
result.M11 = 1.0f;
result.M12 = yTan;
@@ -302,8 +302,8 @@ namespace System.Numerics
{
Matrix3x2 result;
float xTan = (float)Math.Tan(radiansX);
float yTan = (float)Math.Tan(radiansY);
float xTan = MathF.Tan(radiansX);
float yTan = MathF.Tan(radiansY);
float tx = -centerPoint.Y * xTan;
float ty = -centerPoint.X * yTan;
@@ -327,11 +327,11 @@ namespace System.Numerics
{
Matrix3x2 result;
radians = (float)Math.IEEERemainder(radians, Math.PI * 2);
radians = MathF.IEEERemainder(radians, MathF.PI * 2);
float c, s;
const float epsilon = 0.001f * (float)Math.PI / 180f; // 0.1% of a degree
const float epsilon = 0.001f * MathF.PI / 180f; // 0.1% of a degree
if (radians > -epsilon && radians < epsilon)
{
@@ -339,19 +339,19 @@ namespace System.Numerics
c = 1;
s = 0;
}
else if (radians > Math.PI / 2 - epsilon && radians < Math.PI / 2 + epsilon)
else if (radians > MathF.PI / 2 - epsilon && radians < MathF.PI / 2 + epsilon)
{
// Exact case for 90 degree rotation.
c = 0;
s = 1;
}
else if (radians < -Math.PI + epsilon || radians > Math.PI - epsilon)
else if (radians < -MathF.PI + epsilon || radians > MathF.PI - epsilon)
{
// Exact case for 180 degree rotation.
c = -1;
s = 0;
}
else if (radians > -Math.PI / 2 - epsilon && radians < -Math.PI / 2 + epsilon)
else if (radians > -MathF.PI / 2 - epsilon && radians < -MathF.PI / 2 + epsilon)
{
// Exact case for 270 degree rotation.
c = 0;
@@ -360,8 +360,8 @@ namespace System.Numerics
else
{
// Arbitrary rotation.
c = (float)Math.Cos(radians);
s = (float)Math.Sin(radians);
c = MathF.Cos(radians);
s = MathF.Sin(radians);
}
// [ c s ]
@@ -387,11 +387,11 @@ namespace System.Numerics
{
Matrix3x2 result;
radians = (float)Math.IEEERemainder(radians, Math.PI * 2);
radians = MathF.IEEERemainder(radians, MathF.PI * 2);
float c, s;
const float epsilon = 0.001f * (float)Math.PI / 180f; // 0.1% of a degree
const float epsilon = 0.001f * MathF.PI / 180f; // 0.1% of a degree
if (radians > -epsilon && radians < epsilon)
{
@@ -399,19 +399,19 @@ namespace System.Numerics
c = 1;
s = 0;
}
else if (radians > Math.PI / 2 - epsilon && radians < Math.PI / 2 + epsilon)
else if (radians > MathF.PI / 2 - epsilon && radians < MathF.PI / 2 + epsilon)
{
// Exact case for 90 degree rotation.
c = 0;
s = 1;
}
else if (radians < -Math.PI + epsilon || radians > Math.PI - epsilon)
else if (radians < -MathF.PI + epsilon || radians > MathF.PI - epsilon)
{
// Exact case for 180 degree rotation.
c = -1;
s = 0;
}
else if (radians > -Math.PI / 2 - epsilon && radians < -Math.PI / 2 + epsilon)
else if (radians > -MathF.PI / 2 - epsilon && radians < -MathF.PI / 2 + epsilon)
{
// Exact case for 270 degree rotation.
c = 0;
@@ -420,8 +420,8 @@ namespace System.Numerics
else
{
// Arbitrary rotation.
c = (float)Math.Cos(radians);
s = (float)Math.Sin(radians);
c = MathF.Cos(radians);
s = MathF.Sin(radians);
}
float x = centerPoint.X * (1 - c) + centerPoint.Y * s;
@@ -476,7 +476,7 @@ namespace System.Numerics
{
float det = (matrix.M11 * matrix.M22) - (matrix.M21 * matrix.M12);
if (Math.Abs(det) < float.Epsilon)
if (MathF.Abs(det) < float.Epsilon)
{
result = new Matrix3x2(float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN);
return false;
@@ -802,9 +802,9 @@ namespace System.Numerics
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
return M11.GetHashCode() + M12.GetHashCode() +
M21.GetHashCode() + M22.GetHashCode() +
M31.GetHashCode() + M32.GetHashCode();
return unchecked(M11.GetHashCode() + M12.GetHashCode() +
M21.GetHashCode() + M22.GetHashCode() +
M31.GetHashCode() + M32.GetHashCode());
}
}
}

View File

@@ -207,7 +207,7 @@ namespace System.Numerics
}
else
{
zaxis = Vector3.Multiply(zaxis, 1.0f / (float)Math.Sqrt(norm));
zaxis = Vector3.Multiply(zaxis, 1.0f / MathF.Sqrt(norm));
}
Vector3 xaxis = Vector3.Normalize(Vector3.Cross(cameraUpVector, zaxis));
@@ -249,7 +249,7 @@ namespace System.Numerics
public static Matrix4x4 CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3 cameraForwardVector, Vector3 objectForwardVector)
{
const float epsilon = 1e-4f;
const float minAngle = 1.0f - (0.1f * ((float)Math.PI / 180.0f)); // 0.1 degrees
const float minAngle = 1.0f - (0.1f * (MathF.PI / 180.0f)); // 0.1 degrees
// Treat the case when object and camera positions are too close.
Vector3 faceDir = new Vector3(
@@ -265,7 +265,7 @@ namespace System.Numerics
}
else
{
faceDir = Vector3.Multiply(faceDir, (1.0f / (float)Math.Sqrt(norm)));
faceDir = Vector3.Multiply(faceDir, (1.0f / MathF.Sqrt(norm)));
}
Vector3 yaxis = rotateAxis;
@@ -275,16 +275,16 @@ namespace System.Numerics
// Treat the case when angle between faceDir and rotateAxis is too close to 0.
float dot = Vector3.Dot(rotateAxis, faceDir);
if (Math.Abs(dot) > minAngle)
if (MathF.Abs(dot) > minAngle)
{
zaxis = objectForwardVector;
// Make sure passed values are useful for compute.
dot = Vector3.Dot(rotateAxis, zaxis);
if (Math.Abs(dot) > minAngle)
if (MathF.Abs(dot) > minAngle)
{
zaxis = (Math.Abs(rotateAxis.Z) > minAngle) ? new Vector3(1, 0, 0) : new Vector3(0, 0, -1);
zaxis = (MathF.Abs(rotateAxis.Z) > minAngle) ? new Vector3(1, 0, 0) : new Vector3(0, 0, -1);
}
xaxis = Vector3.Normalize(Vector3.Cross(rotateAxis, zaxis));
@@ -583,8 +583,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
// [ 1 0 0 0 ]
// [ 0 c s 0 ]
@@ -620,8 +620,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
float y = centerPoint.Y * (1 - c) + centerPoint.Z * s;
float z = centerPoint.Z * (1 - c) - centerPoint.Y * s;
@@ -659,8 +659,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
// [ c 0 -s 0 ]
// [ 0 1 0 0 ]
@@ -696,8 +696,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
float x = centerPoint.X * (1 - c) - centerPoint.Z * s;
float z = centerPoint.Z * (1 - c) + centerPoint.X * s;
@@ -735,8 +735,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
// [ c s 0 0 ]
// [ -s c 0 0 ]
@@ -772,8 +772,8 @@ namespace System.Numerics
{
Matrix4x4 result;
float c = (float)Math.Cos(radians);
float s = (float)Math.Sin(radians);
float c = MathF.Cos(radians);
float s = MathF.Sin(radians);
float x = centerPoint.X * (1 - c) + centerPoint.Y * s;
float y = centerPoint.Y * (1 - c) - centerPoint.X * s;
@@ -836,7 +836,7 @@ namespace System.Numerics
// [ zx-cosa*zx-sina*y zy-cosa*zy+sina*x zz+cosa*(1-zz) ]
//
float x = axis.X, y = axis.Y, z = axis.Z;
float sa = (float)Math.Sin(angle), ca = (float)Math.Cos(angle);
float sa = MathF.Sin(angle), ca = MathF.Cos(angle);
float xx = x * x, yy = y * y, zz = z * z;
float xy = x * y, xz = x * z, yz = y * z;
@@ -872,7 +872,7 @@ namespace System.Numerics
/// <returns>The perspective projection matrix.</returns>
public static Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
{
if (fieldOfView <= 0.0f || fieldOfView >= Math.PI)
if (fieldOfView <= 0.0f || fieldOfView >= MathF.PI)
throw new ArgumentOutOfRangeException(nameof(fieldOfView));
if (nearPlaneDistance <= 0.0f)
@@ -884,7 +884,7 @@ namespace System.Numerics
if (nearPlaneDistance >= farPlaneDistance)
throw new ArgumentOutOfRangeException(nameof(nearPlaneDistance));
float yScale = 1.0f / (float)Math.Tan(fieldOfView * 0.5f);
float yScale = 1.0f / MathF.Tan(fieldOfView * 0.5f);
float xScale = yScale / aspectRatio;
Matrix4x4 result;
@@ -896,11 +896,12 @@ namespace System.Numerics
result.M21 = result.M23 = result.M24 = 0.0f;
result.M31 = result.M32 = 0.0f;
result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
var negFarRange = float.IsPositiveInfinity(farPlaneDistance) ? -1.0f : farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M33 = negFarRange;
result.M34 = -1.0f;
result.M41 = result.M42 = result.M44 = 0.0f;
result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M43 = nearPlaneDistance * negFarRange;
return result;
}
@@ -932,12 +933,13 @@ namespace System.Numerics
result.M22 = 2.0f * nearPlaneDistance / height;
result.M21 = result.M23 = result.M24 = 0.0f;
result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
var negFarRange = float.IsPositiveInfinity(farPlaneDistance) ? -1.0f : farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M33 = negFarRange;
result.M31 = result.M32 = 0.0f;
result.M34 = -1.0f;
result.M41 = result.M42 = result.M44 = 0.0f;
result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M43 = nearPlaneDistance * negFarRange;
return result;
}
@@ -973,10 +975,11 @@ namespace System.Numerics
result.M31 = (left + right) / (right - left);
result.M32 = (top + bottom) / (top - bottom);
result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
var negFarRange = float.IsPositiveInfinity(farPlaneDistance) ? -1.0f : farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M33 = negFarRange;
result.M34 = -1.0f;
result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M43 = nearPlaneDistance * negFarRange;
result.M41 = result.M42 = result.M44 = 0.0f;
return result;
@@ -1418,7 +1421,7 @@ namespace System.Numerics
float det = a * a11 + b * a12 + c * a13 + d * a14;
if (Math.Abs(det) < float.Epsilon)
if (MathF.Abs(det) < float.Epsilon)
{
result = new Matrix4x4(float.NaN, float.NaN, float.NaN, float.NaN,
float.NaN, float.NaN, float.NaN, float.NaN,
@@ -1596,9 +1599,9 @@ namespace System.Numerics
uint cc;
float fAbsX, fAbsY, fAbsZ;
fAbsX = (float)Math.Abs(pVectorBasis[a]->X);
fAbsY = (float)Math.Abs(pVectorBasis[a]->Y);
fAbsZ = (float)Math.Abs(pVectorBasis[a]->Z);
fAbsX = MathF.Abs(pVectorBasis[a]->X);
fAbsY = MathF.Abs(pVectorBasis[a]->Y);
fAbsZ = MathF.Abs(pVectorBasis[a]->Z);
#region Ranking
if (fAbsX < fAbsY)
@@ -2204,10 +2207,13 @@ namespace System.Numerics
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
return M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() +
M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() +
M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() +
M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
unchecked
{
return M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() +
M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() +
M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() +
M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
}
}
}
}

View File

@@ -97,7 +97,7 @@ namespace System.Numerics
// Normalize(N)
float ls = nx * nx + ny * ny + nz * nz;
float invNorm = 1.0f / (float)Math.Sqrt((double)ls);
float invNorm = 1.0f / MathF.Sqrt(ls);
Vector3 normal = new Vector3(
nx * invNorm,
@@ -122,12 +122,12 @@ namespace System.Numerics
if (Vector.IsHardwareAccelerated)
{
float normalLengthSquared = value.Normal.LengthSquared();
if (Math.Abs(normalLengthSquared - 1.0f) < FLT_EPSILON)
if (MathF.Abs(normalLengthSquared - 1.0f) < FLT_EPSILON)
{
// It already normalized, so we don't need to farther process.
return value;
}
float normalLength = (float)Math.Sqrt(normalLengthSquared);
float normalLength = MathF.Sqrt(normalLengthSquared);
return new Plane(
value.Normal / normalLength,
value.D / normalLength);
@@ -136,12 +136,12 @@ namespace System.Numerics
{
float f = value.Normal.X * value.Normal.X + value.Normal.Y * value.Normal.Y + value.Normal.Z * value.Normal.Z;
if (Math.Abs(f - 1.0f) < FLT_EPSILON)
if (MathF.Abs(f - 1.0f) < FLT_EPSILON)
{
return value; // It already normalized, so we don't need to further process.
}
float fInv = 1.0f / (float)Math.Sqrt(f);
float fInv = 1.0f / MathF.Sqrt(f);
return new Plane(
value.Normal.X * fInv,

View File

@@ -81,7 +81,7 @@ namespace System.Numerics
{
float ls = X * X + Y * Y + Z * Z + W * W;
return (float)Math.Sqrt((double)ls);
return MathF.Sqrt(ls);
}
/// <summary>
@@ -104,7 +104,7 @@ namespace System.Numerics
float ls = value.X * value.X + value.Y * value.Y + value.Z * value.Z + value.W * value.W;
float invNorm = 1.0f / (float)Math.Sqrt((double)ls);
float invNorm = 1.0f / MathF.Sqrt(ls);
ans.X = value.X * invNorm;
ans.Y = value.Y * invNorm;
@@ -167,8 +167,8 @@ namespace System.Numerics
Quaternion ans;
float halfAngle = angle * 0.5f;
float s = (float)Math.Sin(halfAngle);
float c = (float)Math.Cos(halfAngle);
float s = MathF.Sin(halfAngle);
float c = MathF.Cos(halfAngle);
ans.X = axis.X * s;
ans.Y = axis.Y * s;
@@ -192,16 +192,16 @@ namespace System.Numerics
float sr, cr, sp, cp, sy, cy;
float halfRoll = roll * 0.5f;
sr = (float)Math.Sin(halfRoll);
cr = (float)Math.Cos(halfRoll);
sr = MathF.Sin(halfRoll);
cr = MathF.Cos(halfRoll);
float halfPitch = pitch * 0.5f;
sp = (float)Math.Sin(halfPitch);
cp = (float)Math.Cos(halfPitch);
sp = MathF.Sin(halfPitch);
cp = MathF.Cos(halfPitch);
float halfYaw = yaw * 0.5f;
sy = (float)Math.Sin(halfYaw);
cy = (float)Math.Cos(halfYaw);
sy = MathF.Sin(halfYaw);
cy = MathF.Cos(halfYaw);
Quaternion result;
@@ -226,7 +226,7 @@ namespace System.Numerics
if (trace > 0.0f)
{
float s = (float)Math.Sqrt(trace + 1.0f);
float s = MathF.Sqrt(trace + 1.0f);
q.W = s * 0.5f;
s = 0.5f / s;
q.X = (matrix.M23 - matrix.M32) * s;
@@ -237,7 +237,7 @@ namespace System.Numerics
{
if (matrix.M11 >= matrix.M22 && matrix.M11 >= matrix.M33)
{
float s = (float)Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
float s = MathF.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
float invS = 0.5f / s;
q.X = 0.5f * s;
q.Y = (matrix.M12 + matrix.M21) * invS;
@@ -246,7 +246,7 @@ namespace System.Numerics
}
else if (matrix.M22 > matrix.M33)
{
float s = (float)Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
float s = MathF.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
float invS = 0.5f / s;
q.X = (matrix.M21 + matrix.M12) * invS;
q.Y = 0.5f * s;
@@ -255,7 +255,7 @@ namespace System.Numerics
}
else
{
float s = (float)Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
float s = MathF.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
float invS = 0.5f / s;
q.X = (matrix.M31 + matrix.M13) * invS;
q.Y = (matrix.M32 + matrix.M23) * invS;
@@ -315,13 +315,13 @@ namespace System.Numerics
}
else
{
float omega = (float)Math.Acos(cosOmega);
float invSinOmega = (float)(1 / Math.Sin(omega));
float omega = MathF.Acos(cosOmega);
float invSinOmega = 1 / MathF.Sin(omega);
s1 = (float)Math.Sin((1.0f - t) * omega) * invSinOmega;
s1 = MathF.Sin((1.0f - t) * omega) * invSinOmega;
s2 = (flip)
? (float)-Math.Sin(t * omega) * invSinOmega
: (float)Math.Sin(t * omega) * invSinOmega;
? -MathF.Sin(t * omega) * invSinOmega
: MathF.Sin(t * omega) * invSinOmega;
}
Quaternion ans;
@@ -368,7 +368,7 @@ namespace System.Numerics
// Normalize it.
float ls = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
float invNorm = 1.0f / (float)Math.Sqrt((double)ls);
float invNorm = 1.0f / MathF.Sqrt(ls);
r.X *= invNorm;
r.Y *= invNorm;
@@ -788,7 +788,7 @@ namespace System.Numerics
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode();
return unchecked(X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode());
}
}
}

View File

@@ -1 +1 @@
dd58b4da6b7d6bc85cce8c6c0cc55ff01f7b98e2
9e4eb703aaceb3c7a02e8fb8d863320bf33bca56

View File

@@ -233,12 +233,12 @@ namespace System.Numerics
}
#pragma warning disable 3001 // void* is not a CLS-Compliant argument type
private unsafe Vector(void* dataPointer) : this(dataPointer, 0) { }
internal unsafe Vector(void* dataPointer) : this(dataPointer, 0) { }
#pragma warning restore 3001 // void* is not a CLS-Compliant argument type
#pragma warning disable 3001 // void* is not a CLS-Compliant argument type
// Implemented with offset if this API ever becomes public; an offset of 0 is used internally.
private unsafe Vector(void* dataPointer, int offset)
internal unsafe Vector(void* dataPointer, int offset)
: this()
{
<# foreach (Type type in supportedTypes)
@@ -1454,7 +1454,7 @@ namespace System.Numerics
<#=type.Name#>* dataPtr = stackalloc <#=type.Name#>[Count];
for (int g = 0; g < Count; g++)
{
dataPtr[g] = (<#=type.Name#>)Math.Sqrt((<#=type.Name#>)(object)value[g]);
dataPtr[g] = unchecked((<#=type.Name#>)Math.Sqrt((<#=type.Name#>)(object)value[g]));
}
return new Vector<T>(dataPtr);
}
@@ -1560,7 +1560,7 @@ namespace System.Numerics
#>
<#=GenerateIfStatementHeader(type)#>
{
return (T)(object)(<#=type.Name#>)((<#=type.Name#>)(object)left + (<#=type.Name#>)(object)right);
return (T)(object)unchecked((<#=type.Name#>)((<#=type.Name#>)(object)left + (<#=type.Name#>)(object)right));
}
<#
}
@@ -1598,7 +1598,7 @@ namespace System.Numerics
#>
<#=GenerateIfStatementHeader(type)#>
{
return (T)(object)(<#=type.Name#>)((<#=type.Name#>)(object)left * (<#=type.Name#>)(object)right);
return (T)(object)unchecked((<#=type.Name#>)((<#=type.Name#>)(object)left * (<#=type.Name#>)(object)right));
}
<#
}
@@ -1688,4 +1688,127 @@ namespace System.Numerics
}
#endregion
}
public static partial class Vector
{
#region Widen/Narrow
<# foreach (Type type in WidenableTypes)
{
Type widenTarget = GetWidenTarget(type);
#>
/// <summary>
/// Widens a Vector{<#=type.Name#>} into two Vector{<#=widenTarget.Name#>}'s.
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
/// </summary>
<#
if (nonClsCompliantTypes.Contains(type) || nonClsCompliantTypes.Contains(widenTarget))
{
#>
[CLSCompliant(false)]
<#
}
#>
[JitIntrinsic]
public static unsafe void Widen(Vector<<#=type.Name#>> source, out Vector<<#=widenTarget.Name#>> low, out Vector<<#=widenTarget.Name#>> high)
{
int elements = Vector<<#=type.Name#>>.Count;
<#=widenTarget.Name#>* lowPtr = stackalloc <#=widenTarget.Name#>[elements / 2];
for (int i = 0; i < elements / 2; i++)
{
lowPtr[i] = (<#=widenTarget.Name#>)source[i];
}
<#=widenTarget.Name#>* highPtr = stackalloc <#=widenTarget.Name#>[elements / 2];
for (int i = 0; i < elements / 2; i++)
{
highPtr[i] = (<#=widenTarget.Name#>)source[i + (elements / 2)];
}
low = new Vector<<#=widenTarget.Name#>>(lowPtr);
high = new Vector<<#=widenTarget.Name#>>(highPtr);
}
<#
}
#>
<# foreach (Type narrowSource in NarrowableTypes)
{
Type narrowTarget = GetNarrowTarget(narrowSource);
#>
/// <summary>
/// Narrows two Vector{<#=narrowSource.Name#>}'s into one Vector{<#=narrowTarget.Name#>}.
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
/// <returns>A Vector{<#=narrowTarget.Name#>} containing elements narrowed from the source vectors.</returns>
/// </summary>
<#
if (nonClsCompliantTypes.Contains(narrowSource) || nonClsCompliantTypes.Contains(narrowTarget))
{
#>
[CLSCompliant(false)]
<#
}
#>
[JitIntrinsic]
public static unsafe Vector<<#=narrowTarget.Name#>> Narrow(Vector<<#=narrowSource.Name#>> low, Vector<<#=narrowSource.Name#>> high)
{
unchecked
{
int elements = Vector<<#=narrowTarget.Name#>>.Count;
<#=narrowTarget.Name#>* retPtr = stackalloc <#=narrowTarget.Name#>[elements];
for (int i = 0; i < elements / 2; i++)
{
retPtr[i] = (<#=narrowTarget.Name#>)low[i];
}
for (int i = 0; i < elements / 2; i++)
{
retPtr[i + (elements / 2)] = (<#=narrowTarget.Name#>)high[i];
}
return new Vector<<#=narrowTarget.Name#>>(retPtr);
}
}
<#
}
#>
#endregion Widen/Narrow
#region Same-Size Conversion
<# foreach (var pair in SameSizeConversionPairs)
{
#>
/// <summary>
/// Converts a Vector{<#=pair.Key.Name#>} to a Vector{<#=pair.Value.Name#>}.
/// </summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
<#
if (nonClsCompliantTypes.Contains(pair.Key) || nonClsCompliantTypes.Contains(pair.Value))
{
#>
[CLSCompliant(false)]
<#
}
#>
[JitIntrinsic]
public static unsafe Vector<<#=pair.Value.Name#>> ConvertTo<#=pair.Value.Name#>(Vector<<#=pair.Key.Name#>> value)
{
unchecked
{
int elements = Vector<<#=pair.Value.Name#>>.Count;
<#=pair.Value.Name#>* retPtr = stackalloc <#=pair.Value.Name#>[elements];
for (int i = 0; i < elements; i++)
{
retPtr[i] = (<#=pair.Value.Name#>)value[i];
}
return new Vector<<#=pair.Value.Name#>>(retPtr);
}
}
<# } #>
#endregion Same-Size Conversion
}
}

View File

@@ -107,12 +107,12 @@ namespace System.Numerics
if (Vector.IsHardwareAccelerated)
{
float ls = Vector2.Dot(this, this);
return (float)Math.Sqrt(ls);
return MathF.Sqrt(ls);
}
else
{
float ls = X * X + Y * Y;
return (float)Math.Sqrt((double)ls);
return MathF.Sqrt(ls);
}
}
@@ -148,7 +148,7 @@ namespace System.Numerics
{
Vector2 difference = value1 - value2;
float ls = Vector2.Dot(difference, difference);
return (float)System.Math.Sqrt(ls);
return MathF.Sqrt(ls);
}
else
{
@@ -157,7 +157,7 @@ namespace System.Numerics
float ls = dx * dx + dy * dy;
return (float)Math.Sqrt((double)ls);
return MathF.Sqrt(ls);
}
}
@@ -200,7 +200,7 @@ namespace System.Numerics
else
{
float ls = value.X * value.X + value.Y * value.Y;
float invNorm = 1.0f / (float)Math.Sqrt((double)ls);
float invNorm = 1.0f / MathF.Sqrt(ls);
return new Vector2(
value.X * invNorm,

View File

@@ -147,7 +147,7 @@ namespace System.Numerics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Abs(Vector2 value)
{
return new Vector2(Math.Abs(value.X), Math.Abs(value.Y));
return new Vector2(MathF.Abs(value.X), MathF.Abs(value.Y));
}
/// <summary>
@@ -159,7 +159,7 @@ namespace System.Numerics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 SquareRoot(Vector2 value)
{
return new Vector2((Single)Math.Sqrt(value.X), (Single)Math.Sqrt(value.Y));
return new Vector2(MathF.Sqrt(value.X), MathF.Sqrt(value.Y));
}
#endregion Public Static Methods

View File

@@ -116,12 +116,12 @@ namespace System.Numerics
if (Vector.IsHardwareAccelerated)
{
float ls = Vector3.Dot(this, this);
return (float)System.Math.Sqrt(ls);
return MathF.Sqrt(ls);
}
else
{
float ls = X * X + Y * Y + Z * Z;
return (float)System.Math.Sqrt(ls);
return MathF.Sqrt(ls);
}
}
@@ -157,7 +157,7 @@ namespace System.Numerics
{
Vector3 difference = value1 - value2;
float ls = Vector3.Dot(difference, difference);
return (float)System.Math.Sqrt(ls);
return MathF.Sqrt(ls);
}
else
{
@@ -167,7 +167,7 @@ namespace System.Numerics
float ls = dx * dx + dy * dy + dz * dz;
return (float)System.Math.Sqrt((double)ls);
return MathF.Sqrt(ls);
}
}
@@ -211,7 +211,7 @@ namespace System.Numerics
else
{
float ls = value.X * value.X + value.Y * value.Y + value.Z * value.Z;
float length = (float)System.Math.Sqrt(ls);
float length = MathF.Sqrt(ls);
return new Vector3(value.X / length, value.Y / length, value.Z / length);
}
}

Some files were not shown because too many files have changed in this diff Show More