Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Avalonia.Controls.TreeDataGrid.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36603.0 d17.14
# Visual Studio Version 18
VisualStudioVersion = 18.1.11312.151 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{00673DCE-6218-4BAC-9026-F9BA18D241AE}"
EndProject
Expand Down Expand Up @@ -38,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{754FC069-D
docs\selection.md = docs\selection.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Controls.TreeDataGrid.Benchmark", "tests\Avalonia.Controls.TreeDataGrid.Benchmark\Avalonia.Controls.TreeDataGrid.Benchmark.csproj", "{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -58,6 +60,10 @@ Global
{9A36E37E-2C03-4B5A-B7EE-A91DC95C3E4A}.Release|Any CPU.Build.0 = Release|Any CPU
{D45C7B46-A12C-4412-8397-B51B75A09999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D45C7B46-A12C-4412-8397-B51B75A09999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -66,6 +72,7 @@ Global
{90F93B90-3622-4332-9E7A-E6D7062422C1} = {00673DCE-6218-4BAC-9026-F9BA18D241AE}
{9A36E37E-2C03-4B5A-B7EE-A91DC95C3E4A} = {A8CF7AE6-C46F-4930-85AF-13126EAC5E6E}
{D45C7B46-A12C-4412-8397-B51B75A09999} = {AE911386-1B6E-4148-AE8F-9D27325349AF}
{72C8B10B-A8A6-9B7E-C798-B5C392FDB7F1} = {00673DCE-6218-4BAC-9026-F9BA18D241AE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6C219532-B67B-4A0F-BFC0-A22CBE46DFF4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="PolySharp" Version="1.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Avalonia.Controls.TreeDataGrid.Benchmark" />
<InternalsVisibleTo Include="Avalonia.Controls.TreeDataGrid.Tests" />
</ItemGroup>

<!-- '!NET6_0_OR_GREATER' equivalent -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private void ResizerDragDelta(object? sender, VectorEventArgs e)

var pixelWidth = _model.Width.IsAbsolute ? _model.Width.Value : Bounds.Width;

if (double.IsNaN(pixelWidth) || double.IsInfinity(pixelWidth) || pixelWidth + e.Vector.X < 0)
if (!Double.IsFinite(pixelWidth) || pixelWidth + e.Vector.X < 0)
return;

var width = new GridLength(pixelWidth + e.Vector.X, GridUnitType.Pixel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,6 @@ public static int Log2(uint value)
return Log2SoftwareFallback(value);
}

/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since log(0) is undefined.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Log2(ulong value)
{
value |= 1;

uint hi = (uint)(value >> 32);

if (hi == 0)
{
return Log2((uint)value);
}

return 32 + Log2(hi);
}

/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since log(0) is undefined.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Log2(nuint value)
{
#if TARGET_64BIT
return Log2((ulong)value);
#else
return Log2((uint)value);
#endif
}

/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since Log(0) is undefined.
Expand All @@ -96,12 +61,8 @@ private static int Log2SoftwareFallback(uint value)
value |= value >> 08;
value |= value >> 16;

// uint.MaxValue >> 27 is always in range [0 - 31] so we use Unsafe.AddByteOffset to avoid bounds check
return Unsafe.AddByteOffset(
// Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_1100_0100_1010_1100_1101_1101u
ref MemoryMarshal.GetReference(Log2DeBruijn),
// uint|long -> IntPtr cast on 32-bit platforms does expensive overflow checks not needed here
(IntPtr)(int)((value * 0x07C4ACDDu) >> 27));
// Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_1100_0100_1010_1100_1101_1101u
return Log2DeBruijn[(int)((value * 0x07C4ACDDu) >> 27)];
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace Avalonia;
using System.Runtime.CompilerServices;

namespace Avalonia;


internal static class Double
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsFinite(double value)
{
return !double.IsNaN(value) && !double.IsInfinity(value);
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading