Automatic defaults for MemPoolBlockSize

This commit is contained in:
Pavel Kirienko 2014-05-07 14:13:49 +04:00
parent 72c89a1e0f
commit cbf5450164

View File

@ -108,8 +108,13 @@ namespace uavcan
* fit this size; otherwise compilation fails.
*/
#if UAVCAN_MEM_POOL_BLOCK_SIZE
/// Explicitly specified by the user.
static const unsigned MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE;
#elif defined(__BIGGEST_ALIGNMENT__) && (__BIGGEST_ALIGNMENT__ <= 8)
/// Convenient default for GCC-like compilers - if alignment allows, pool block size can be safely reduced.
static const unsigned MemPoolBlockSize = 56;
#else
/// Safe default that should be OK for any platform.
static const unsigned MemPoolBlockSize = 64;
#endif