File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,6 @@ namespace fb_utils
275
275
static_assert (std::is_integral_v<T>, " Integral type expected" );
276
276
277
277
constexpr auto len = sizeof (T);
278
- static_assert (len == 1 || len == 2 || len == 4 || len == 8 , " unknown data type" );
279
278
280
279
if (ptr + len + 1 + 2 > end)
281
280
{
@@ -292,14 +291,16 @@ namespace fb_utils
292
291
*ptr++ = len;
293
292
*ptr++ = 0 ;
294
293
295
- if (len == 8 )
294
+ if constexpr (len == sizeof (SINT64) )
296
295
put_vax_int64 (ptr, value);
297
- else if (len == 4 )
296
+ else if constexpr (len == sizeof (SLONG) )
298
297
put_vax_long (ptr, value);
299
- else if (len == 2 )
298
+ else if constexpr (len == sizeof (SSHORT) )
300
299
put_vax_short (ptr, value);
301
- else if (len == 1 )
300
+ else if constexpr (len == sizeof ( char ) )
302
301
*ptr = value;
302
+ else
303
+ static_assert (false , " unknown data type" );
303
304
304
305
ptr += len;
305
306
return ptr;
You can’t perform that action at this time.
0 commit comments