@@ -871,7 +871,7 @@ static int b2ComputeHeight( const b2DynamicTree* tree, int32_t nodeId )
871871
872872 int32_t height1 = b2ComputeHeight ( tree , node -> child1 );
873873 int32_t height2 = b2ComputeHeight ( tree , node -> child2 );
874- return 1 + b2MaxInt16 ( height1 , height2 );
874+ return 1 + b2MaxInt ( height1 , height2 );
875875}
876876
877877int b2DynamicTree_ComputeHeight ( const b2DynamicTree * tree )
@@ -930,8 +930,8 @@ static void b2ValidateMetrics( const b2DynamicTree* tree, int32_t index )
930930
931931 const b2TreeNode * node = tree -> nodes + index ;
932932
933- int32_t child1 = node -> child1 ;
934- int32_t child2 = node -> child2 ;
933+ int child1 = node -> child1 ;
934+ int child2 = node -> child2 ;
935935
936936 if ( b2IsLeaf ( node ) )
937937 {
@@ -944,10 +944,9 @@ static void b2ValidateMetrics( const b2DynamicTree* tree, int32_t index )
944944 B2_ASSERT ( 0 <= child1 && child1 < tree -> nodeCapacity );
945945 B2_ASSERT ( 0 <= child2 && child2 < tree -> nodeCapacity );
946946
947- int32_t height1 = tree -> nodes [child1 ].height ;
948- int32_t height2 = tree -> nodes [child2 ].height ;
949- int32_t height ;
950- height = 1 + b2MaxInt16 ( height1 , height2 );
947+ int height1 = tree -> nodes [child1 ].height ;
948+ int height2 = tree -> nodes [child2 ].height ;
949+ int height = 1 + b2MaxInt ( height1 , height2 );
951950 B2_ASSERT ( node -> height == height );
952951
953952 // b2AABB aabb = b2AABB_Union(tree->nodes[child1].aabb, tree->nodes[child2].aabb);
@@ -1000,8 +999,8 @@ void b2DynamicTree_Validate( const b2DynamicTree* tree )
1000999
10011000int32_t b2DynamicTree_GetMaxBalance ( const b2DynamicTree * tree )
10021001{
1003- int32_t maxBalance = 0 ;
1004- for ( int32_t i = 0 ; i < tree -> nodeCapacity ; ++ i )
1002+ int maxBalance = 0 ;
1003+ for ( int i = 0 ; i < tree -> nodeCapacity ; ++ i )
10051004 {
10061005 const b2TreeNode * node = tree -> nodes + i ;
10071006 if ( node -> height <= 1 )
@@ -1011,9 +1010,9 @@ int32_t b2DynamicTree_GetMaxBalance( const b2DynamicTree* tree )
10111010
10121011 B2_ASSERT ( b2IsLeaf ( node ) == false );
10131012
1014- int32_t child1 = node -> child1 ;
1015- int32_t child2 = node -> child2 ;
1016- int32_t balance = b2AbsFloat ( tree -> nodes [child2 ].height - tree -> nodes [child1 ].height );
1013+ int child1 = node -> child1 ;
1014+ int child2 = node -> child2 ;
1015+ int balance = b2AbsInt ( tree -> nodes [child2 ].height - tree -> nodes [child1 ].height );
10171016 maxBalance = b2MaxInt ( maxBalance , balance );
10181017 }
10191018
@@ -1022,11 +1021,11 @@ int32_t b2DynamicTree_GetMaxBalance( const b2DynamicTree* tree )
10221021
10231022void b2DynamicTree_RebuildBottomUp ( b2DynamicTree * tree )
10241023{
1025- int32_t * nodes = b2Alloc ( tree -> nodeCount * sizeof ( int32_t ) );
1026- int32_t count = 0 ;
1024+ int * nodes = b2Alloc ( tree -> nodeCount * sizeof ( int ) );
1025+ int count = 0 ;
10271026
10281027 // Build array of leaves. Free the rest.
1029- for ( int32_t i = 0 ; i < tree -> nodeCapacity ; ++ i )
1028+ for ( int i = 0 ; i < tree -> nodeCapacity ; ++ i )
10301029 {
10311030 if ( tree -> nodes [i ].height < 0 )
10321031 {
0 commit comments