3
3
// SPDX-License-Identifier: MIT
4
4
5
5
using System ;
6
+ using System . Runtime . CompilerServices ;
6
7
using static Box2D . NET . B2Constants ;
7
8
using static Box2D . NET . B2Diagnostics ;
8
9
using static Box2D . NET . B2Buffers ;
@@ -32,16 +33,19 @@ public static class B2DynamicTrees
32
33
flags = ( ushort ) B2TreeNodeFlags . b2_allocatedNode ,
33
34
} ;
34
35
36
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
35
37
public static bool b2IsLeaf ( ref B2TreeNode node )
36
38
{
37
39
return 0 != ( node . flags & ( ushort ) B2TreeNodeFlags . b2_leafNode ) ;
38
40
}
39
41
42
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
40
43
public static bool b2IsAllocated ( ref B2TreeNode node )
41
44
{
42
45
return 0 != ( node . flags & ( ushort ) B2TreeNodeFlags . b2_allocatedNode ) ;
43
46
}
44
47
48
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
45
49
public static ushort b2MaxUInt16 ( ushort a , ushort b )
46
50
{
47
51
return a > b ? a : b ;
@@ -775,6 +779,7 @@ public static void b2DynamicTree_DestroyProxy(B2DynamicTree tree, int proxyId)
775
779
}
776
780
777
781
/// Get the number of proxies created
782
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
778
783
public static int b2DynamicTree_GetProxyCount ( B2DynamicTree tree )
779
784
{
780
785
return tree . proxyCount ;
@@ -910,6 +915,7 @@ public static float b2DynamicTree_GetAreaRatio(B2DynamicTree tree)
910
915
}
911
916
912
917
/// Get the bounding box that contains the entire tree
918
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
913
919
public static B2AABB b2DynamicTree_GetRootBounds ( B2DynamicTree tree )
914
920
{
915
921
if ( tree . root != B2_NULL_INDEX )
@@ -1078,6 +1084,7 @@ public static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree)
1078
1084
}
1079
1085
1080
1086
/// Get the number of bytes used by this tree
1087
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1081
1088
public static int b2DynamicTree_GetByteCount ( B2DynamicTree tree )
1082
1089
{
1083
1090
// TODO: @ikpil, check
@@ -1088,13 +1095,15 @@ public static int b2DynamicTree_GetByteCount(B2DynamicTree tree)
1088
1095
}
1089
1096
1090
1097
/// Get proxy user data
1098
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1091
1099
public static ulong b2DynamicTree_GetUserData ( B2DynamicTree tree , int proxyId )
1092
1100
{
1093
1101
B2_ASSERT ( 0 <= proxyId && proxyId < tree . nodeCapacity ) ;
1094
1102
return tree . nodes [ proxyId ] . children . userData ;
1095
1103
}
1096
1104
1097
1105
/// Get the AABB of a proxy
1106
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1098
1107
public static B2AABB b2DynamicTree_GetAABB ( B2DynamicTree tree , int proxyId )
1099
1108
{
1100
1109
B2_ASSERT ( 0 <= proxyId && proxyId < tree . nodeCapacity ) ;
0 commit comments