From 5345dd794f548d7f9ed9659af02a313827810b02 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 6 Mar 2014 16:53:58 +0400 Subject: [PATCH] Optimized array initialization --- libuavcan/include/uavcan/internal/marshal/array.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libuavcan/include/uavcan/internal/marshal/array.hpp b/libuavcan/include/uavcan/internal/marshal/array.hpp index 5fdfd6bb53..497cfe15c4 100644 --- a/libuavcan/include/uavcan/internal/marshal/array.hpp +++ b/libuavcan/include/uavcan/internal/marshal/array.hpp @@ -122,7 +122,11 @@ private: BufferType data_; template - typename EnableIf::Type initialize(int) { std::fill(data_, data_ + MaxSize, U()); } + typename EnableIf::Type initialize(int) + { + if (ArrayMode != ArrayModeDynamic) + std::fill(data_, data_ + MaxSize, U()); + } template void initialize(...) { } public: