diff --git a/crnlib/crn_packed_uint.h b/crnlib/crn_packed_uint.h index df55e6b4..dedca4ae 100644 --- a/crnlib/crn_packed_uint.h +++ b/crnlib/crn_packed_uint.h @@ -39,7 +39,7 @@ struct packed_uint { } inline operator unsigned int() const { - switch (sizeof(m_buf)) { + switch (sizeof(m_buf) / sizeof(m_buf[0])) { case 1: return m_buf[0]; case 2: diff --git a/inc/crn_defs.h b/inc/crn_defs.h index 0f41c0eb..0a457ccb 100644 --- a/inc/crn_defs.h +++ b/inc/crn_defs.h @@ -225,7 +225,7 @@ struct crn_packed_uint { } inline operator unsigned int() const { - switch (sizeof(m_buf)) { + switch (sizeof(m_buf) / sizeof(m_buf[0])) { case 1: return m_buf[0]; case 2: