Skip to content

Commit 4527f4a

Browse files
committed
added AggressiveInlining in B2DynmaicTrees
1 parent 87ec303 commit 4527f4a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Box2D.NET/B2DynamicTrees.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: MIT
44

55
using System;
6+
using System.Runtime.CompilerServices;
67
using static Box2D.NET.B2Constants;
78
using static Box2D.NET.B2Diagnostics;
89
using static Box2D.NET.B2Buffers;
@@ -32,16 +33,19 @@ public static class B2DynamicTrees
3233
flags = (ushort)B2TreeNodeFlags.b2_allocatedNode,
3334
};
3435

36+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3537
public static bool b2IsLeaf(ref B2TreeNode node)
3638
{
3739
return 0 != (node.flags & (ushort)B2TreeNodeFlags.b2_leafNode);
3840
}
3941

42+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4043
public static bool b2IsAllocated(ref B2TreeNode node)
4144
{
4245
return 0 != (node.flags & (ushort)B2TreeNodeFlags.b2_allocatedNode);
4346
}
4447

48+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4549
public static ushort b2MaxUInt16(ushort a, ushort b)
4650
{
4751
return a > b ? a : b;
@@ -775,6 +779,7 @@ public static void b2DynamicTree_DestroyProxy(B2DynamicTree tree, int proxyId)
775779
}
776780

777781
/// Get the number of proxies created
782+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
778783
public static int b2DynamicTree_GetProxyCount(B2DynamicTree tree)
779784
{
780785
return tree.proxyCount;
@@ -910,6 +915,7 @@ public static float b2DynamicTree_GetAreaRatio(B2DynamicTree tree)
910915
}
911916

912917
/// Get the bounding box that contains the entire tree
918+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
913919
public static B2AABB b2DynamicTree_GetRootBounds(B2DynamicTree tree)
914920
{
915921
if (tree.root != B2_NULL_INDEX)
@@ -1078,6 +1084,7 @@ public static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree)
10781084
}
10791085

10801086
/// Get the number of bytes used by this tree
1087+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10811088
public static int b2DynamicTree_GetByteCount(B2DynamicTree tree)
10821089
{
10831090
// TODO: @ikpil, check
@@ -1088,13 +1095,15 @@ public static int b2DynamicTree_GetByteCount(B2DynamicTree tree)
10881095
}
10891096

10901097
/// Get proxy user data
1098+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10911099
public static ulong b2DynamicTree_GetUserData(B2DynamicTree tree, int proxyId)
10921100
{
10931101
B2_ASSERT(0 <= proxyId && proxyId < tree.nodeCapacity);
10941102
return tree.nodes[proxyId].children.userData;
10951103
}
10961104

10971105
/// Get the AABB of a proxy
1106+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10981107
public static B2AABB b2DynamicTree_GetAABB(B2DynamicTree tree, int proxyId)
10991108
{
11001109
B2_ASSERT(0 <= proxyId && proxyId < tree.nodeCapacity);

0 commit comments

Comments
 (0)