From 1d36b57d83fe841b40232f156102c45713c34c2b Mon Sep 17 00:00:00 2001 From: Matthew Bennice Date: Mon, 21 Aug 2023 21:30:11 -0700 Subject: [PATCH] Switch from max_align_t to mjtNum until we sort out the git builds PiperOrigin-RevId: 558982369 Change-Id: I24d9fd6400dae5e1bc1753ee74484da635ea8ecd --- src/engine/engine_io.c | 5 +++-- test/engine/engine_util_container_test.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/engine/engine_io.c b/src/engine/engine_io.c index 43c68baf..8ce41761 100644 --- a/src/engine/engine_io.c +++ b/src/engine/engine_io.c @@ -1213,8 +1213,9 @@ void* mj_stackAllocBytes(mjData* d, size_t size) { // start of the memory to be allocated to the buffer uintptr_t start_ptr = end_ptr - (size + mjREDZONE); - // move start_ptr back to align to max_align_t - start_ptr -= start_ptr % _Alignof(max_align_t); + // move start_ptr back to align to mjtNum + // TODO: switch to max_align_t + start_ptr -= start_ptr % _Alignof(mjtNum); // new top of the stack uintptr_t new_pstack_ptr = start_ptr - mjREDZONE; diff --git a/test/engine/engine_util_container_test.cc b/test/engine/engine_util_container_test.cc index 57d50164..4c20eb8e 100644 --- a/test/engine/engine_util_container_test.cc +++ b/test/engine/engine_util_container_test.cc @@ -42,7 +42,7 @@ TEST(TestMjArrayList, TestMjArrayListSingleThreaded) { // Approximately (3 * sizeof(int) + 3 * sizeof(mjArrayList)) / sizeof(mjtNum) // However there is padding for alignment/etc. - EXPECT_EQ(d->maxuse_stack, 54); + EXPECT_EQ(d->maxuse_stack, 53); for (int i = 0; i < 35; ++i) { EXPECT_EQ(*(int*)mju_arrayListAt(array_list, i), i);