File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -142,24 +142,28 @@ inline uint64_t ser_double_to_uint64(double x)
142142{
143143 uint64_t tmp;
144144 std::memcpy (&tmp, &x, sizeof (x));
145+ static_assert (sizeof (tmp) == sizeof (x), " double and uint64_t assumed to have the same size" );
145146 return tmp;
146147}
147148inline uint32_t ser_float_to_uint32 (float x)
148149{
149150 uint32_t tmp;
150151 std::memcpy (&tmp, &x, sizeof (x));
152+ static_assert (sizeof (tmp) == sizeof (x), " float and uint32_t assumed to have the same size" );
151153 return tmp;
152154}
153155inline double ser_uint64_to_double (uint64_t y)
154156{
155157 double tmp;
156158 std::memcpy (&tmp, &y, sizeof (y));
159+ static_assert (sizeof (tmp) == sizeof (y), " double and uint64_t assumed to have the same size" );
157160 return tmp;
158161}
159162inline float ser_uint32_to_float (uint32_t y)
160163{
161164 float tmp;
162165 std::memcpy (&tmp, &y, sizeof (y));
166+ static_assert (sizeof (tmp) == sizeof (y), " float and uint32_t assumed to have the same size" );
163167 return tmp;
164168}
165169
You can’t perform that action at this time.
0 commit comments