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)
142
142
{
143
143
uint64_t tmp;
144
144
std::memcpy (&tmp, &x, sizeof (x));
145
+ static_assert (sizeof (tmp) == sizeof (x), " double and uint64_t assumed to have the same size" );
145
146
return tmp;
146
147
}
147
148
inline uint32_t ser_float_to_uint32 (float x)
148
149
{
149
150
uint32_t tmp;
150
151
std::memcpy (&tmp, &x, sizeof (x));
152
+ static_assert (sizeof (tmp) == sizeof (x), " float and uint32_t assumed to have the same size" );
151
153
return tmp;
152
154
}
153
155
inline double ser_uint64_to_double (uint64_t y)
154
156
{
155
157
double tmp;
156
158
std::memcpy (&tmp, &y, sizeof (y));
159
+ static_assert (sizeof (tmp) == sizeof (y), " double and uint64_t assumed to have the same size" );
157
160
return tmp;
158
161
}
159
162
inline float ser_uint32_to_float (uint32_t y)
160
163
{
161
164
float tmp;
162
165
std::memcpy (&tmp, &y, sizeof (y));
166
+ static_assert (sizeof (tmp) == sizeof (y), " float and uint32_t assumed to have the same size" );
163
167
return tmp;
164
168
}
165
169
You can’t perform that action at this time.
0 commit comments