Fix for PhantomNode packing in MSVC
Changed bool to uint32_t in bit fields to have 4-byte packings for 32 bits: "c++ compilers will allocate bit-fields in memory as follows: several consecutive bit-field members of the same type will be allocated sequentially. As soon as a new type needs to be allocated, it will be aligned with the beginning of the next logical memory block." References: - https://msdn.microsoft.com/en-us/library/ewwyfdbe.aspx - http://stackoverflow.com/questions/308364/c-bitfield-packing-with-bools/308383#308383
This commit is contained in:
@@ -71,13 +71,10 @@ struct SegmentID
|
||||
BOOST_ASSERT(!enabled || id != SPECIAL_SEGMENTID);
|
||||
}
|
||||
|
||||
NodeID id : 31;
|
||||
bool enabled : 1;
|
||||
NodeID id : 31;
|
||||
std::uint32_t enabled : 1;
|
||||
};
|
||||
|
||||
// bit-fields are broken on Windows
|
||||
#ifndef _MSC_VER
|
||||
static_assert(sizeof(SegmentID) == 4, "SegmentID needs to be 4 bytes big");
|
||||
#endif
|
||||
|
||||
#endif /* TYPEDEFS_H */
|
||||
|
||||
Reference in New Issue
Block a user