raw.hpp: Require high bits to be 0 when unpacking bool
This commit is contained in:
parent
6495004302
commit
1e10d3dc47
1 changed files with 7 additions and 1 deletions
|
|
@ -236,7 +236,13 @@ namespace fc {
|
|||
|
||||
// bool
|
||||
template<typename Stream> inline void pack( Stream& s, const bool& v ) { pack( s, uint8_t(v) ); }
|
||||
template<typename Stream> inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=(b!=0); }
|
||||
template<typename Stream> inline void unpack( Stream& s, bool& v )
|
||||
{
|
||||
uint8_t b;
|
||||
unpack( s, b );
|
||||
FC_ASSERT( (b & ~1) == 0 );
|
||||
v=(b!=0);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue