Defaults for dynamic memory: Default block size is 64 bytes; packing is disabled by default; alignment set to __BIGGEST_ALIGNMENT__ if available, otherwise 16 bytes.

This commit is contained in:
Pavel Kirienko
2014-04-05 16:55:03 +04:00
parent 54606e494a
commit e077bbf7a9
+7 -3
View File
@@ -48,10 +48,10 @@
# define UAVCAN_PACK_STRUCTS 0 # define UAVCAN_PACK_STRUCTS 0
#endif #endif
#ifndef UAVCAN_PACKED_BEGIN #ifndef UAVCAN_PACKED_BEGIN
# define UAVCAN_PACKED_BEGIN _Pragma("pack(push, 1)") # define UAVCAN_PACKED_BEGIN
#endif #endif
#ifndef UAVCAN_PACKED_END #ifndef UAVCAN_PACKED_END
# define UAVCAN_PACKED_END _Pragma("pack(pop)") # define UAVCAN_PACKED_END
#endif #endif
@@ -66,10 +66,14 @@ namespace uavcan
#if UAVCAN_MEM_POOL_BLOCK_SIZE #if UAVCAN_MEM_POOL_BLOCK_SIZE
enum { MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE }; enum { MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE };
#else #else
enum { MemPoolBlockSize = 48 }; enum { MemPoolBlockSize = 64 };
#endif #endif
#ifdef __BIGGEST_ALIGNMENT__
enum { MemPoolAlignment = __BIGGEST_ALIGNMENT__ };
#else
enum { MemPoolAlignment = 16 }; enum { MemPoolAlignment = 16 };
#endif
typedef char _alignment_check_for_MEM_POOL_BLOCK_SIZE[((MemPoolBlockSize & (MemPoolAlignment - 1)) == 0) ? 1 : -1]; typedef char _alignment_check_for_MEM_POOL_BLOCK_SIZE[((MemPoolBlockSize & (MemPoolAlignment - 1)) == 0) ? 1 : -1];