Rename mj_stackAllocByte to mj_stackAlloc and make it public.

PiperOrigin-RevId: 561133040
Change-Id: I4f5ffe51c1287aa0c82af68bfe17ed6dd2ad09da
This commit is contained in:
Saran Tunyasuvunakool
2023-08-29 14:07:02 -07:00
committed by Copybara-Service
parent a48e0aa355
commit 4c899b92cc
16 changed files with 93 additions and 46 deletions
+6 -3
View File
@@ -208,7 +208,8 @@ int mj_collideOBB(const mjtNum aabb1[6], const mjtNum aabb2[6],
}
static mjCollisionTree* mj_stackAllocTree(mjData* d, int max_stack) {
return (mjCollisionTree*)mj_stackAllocByte(d, max_stack * sizeof(mjCollisionTree*));
return (mjCollisionTree*) mj_stackAlloc(
d, max_stack * sizeof(mjCollisionTree), _Alignof(mjCollisionTree));
}
// binary search between two body trees
@@ -751,8 +752,10 @@ int mj_broadphase(const mjModel* m, mjData* d, int* pair, int maxpair) {
}
// allocate sort buffer
sortbuf = (mjtBroadphase*)mj_stackAllocByte(d, 2 * bufcnt * sizeof(mjtBroadphase));
activebuf = (mjtBroadphase*)mj_stackAllocByte(d, 2 *bufcnt * sizeof(mjtBroadphase));
sortbuf = (mjtBroadphase*) mj_stackAlloc(
d, 2 * bufcnt * sizeof(mjtBroadphase), _Alignof(mjtBroadphase));
activebuf = (mjtBroadphase*) mj_stackAlloc(
d, 2 * bufcnt * sizeof(mjtBroadphase), _Alignof(mjtBroadphase));
// init sortbuf with axis0
int k = 0;