diff --git a/src/cpp/Cdr.cpp b/src/cpp/Cdr.cpp index c1a3a5e1..7e76373a 100644 --- a/src/cpp/Cdr.cpp +++ b/src/cpp/Cdr.cpp @@ -387,7 +387,10 @@ void Cdr::set_dds_cdr_options( { auto length {offset_ - cdr_buffer_.begin()}; auto alignment = ((length + 3u) & ~3u) - length; - options_[1] = static_cast(options_[1] & 0xC) + static_cast(alignment & 0x3); + options_[1] = static_cast( + static_cast(options_[1] & 0xC) + + static_cast(alignment & 0x3) + ); } if (encapsulation_serialized_ && CdrVersion::CORBA_CDR < cdr_version_)