Skip to content

Commit

Permalink
Adapt serialize bool (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcarras authored Jun 28, 2023
1 parent d9bce9c commit 2f65584
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cpp/Cdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,18 +684,19 @@ Cdr& Cdr::serialize(
Cdr& Cdr::serialize(
const bool bool_t)
{
uint8_t value = 0;

if (((m_lastPosition - m_currentPosition) >= sizeof(uint8_t)) || resize(sizeof(uint8_t)))
{
// Save last datasize.
m_lastDataSize = sizeof(uint8_t);

if (bool_t)
{
value = 1;
m_currentPosition++ << static_cast<uint8_t>(1);
}
else
{
m_currentPosition++ << static_cast<uint8_t>(0);
}
m_currentPosition++ << value;

return *this;
}
Expand Down

0 comments on commit 2f65584

Please sign in to comment.