From cbf54501642033f0befa0ce70b47ee264988d8a5 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 7 May 2014 14:13:49 +0400 Subject: [PATCH] Automatic defaults for MemPoolBlockSize --- libuavcan/include/uavcan/impl_constants.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libuavcan/include/uavcan/impl_constants.hpp b/libuavcan/include/uavcan/impl_constants.hpp index 726691a32f..0504628812 100644 --- a/libuavcan/include/uavcan/impl_constants.hpp +++ b/libuavcan/include/uavcan/impl_constants.hpp @@ -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