Skip to content

Commit

Permalink
nimble/porting: Fix OS_MEMPOOL_SIZE() macro
Browse files Browse the repository at this point in the history
The OS_MEMPOOL_SIZE() macro returns an invalid
size when guards are used (an additional 4 bytes
must be reserved for each block, which is not done
at the moment). Correct this in line with the
macro defined in mynewt core.
  • Loading branch information
donatieng committed Apr 12, 2024
1 parent 364b720 commit 2336a34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion porting/nimble/include/os/os_mempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ typedef __uint128_t os_membuf_t;
#else
#error "Unhandled `OS_ALIGNMENT` for `os_membuf_t`"
#endif /* OS_ALIGNMENT == * */
#define OS_MEMPOOL_SIZE(n,blksize) ((((blksize) + ((OS_ALIGNMENT)-1)) / (OS_ALIGNMENT)) * (n))
#define OS_MEMPOOL_SIZE(n,blksize) (((OS_MEMPOOL_BLOCK_SZ(blksize) + ((OS_ALIGNMENT)-1)) / (OS_ALIGNMENT)) * (n))

/** Calculates the number of bytes required to initialize a memory pool. */
#define OS_MEMPOOL_BYTES(n,blksize) \
Expand Down

0 comments on commit 2336a34

Please sign in to comment.