Implement mj_stackAlloc and mj_arenaAlloc alignment using bitwise-and.
This implementation explicitly avoids calling division instructions (which are generally expensive) even when link-time optimization is not active or if the alloc functions aren't inlined for some reason. Also make mj_stackAlloc cheaper for external callers who may be linking against MuJoCo dynamically (and therefore cannot benefit from inlining). PiperOrigin-RevId: 561299565 Change-Id: Iea4be5bf6d351ddf0c9d1fd8bd89a0c207b39309
This commit is contained in:
committed by
Copybara-Service
parent
4c899b92cc
commit
215433f5f7
@@ -699,7 +699,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
type=ValueType(name='size_t'),
|
||||
),
|
||||
),
|
||||
doc='Allocate a specific number of bytes on mjData stack. Call mju_error on stack overflow.', # pylint: disable=line-too-long
|
||||
doc='Allocate a number of bytes on mjData stack at a specific alignment which must be a power of 2. Call mju_error on stack overflow.', # pylint: disable=line-too-long
|
||||
)),
|
||||
('mj_stackAllocNum',
|
||||
FunctionDecl(
|
||||
|
||||
Reference in New Issue
Block a user