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
275275 static_assert (std::is_integral_v<T>, " Integral type expected" );
276276
277277 constexpr auto len = sizeof (T);
278- static_assert (len == 1 || len == 2 || len == 4 || len == 8 , " unknown data type" );
279278
280279 if (ptr + len + 1 + 2 > end)
281280 {
@@ -292,14 +291,16 @@ namespace fb_utils
292291 *ptr++ = len;
293292 *ptr++ = 0 ;
294293
295- if (len == 8 )
294+ if constexpr (len == sizeof (SINT64) )
296295 put_vax_int64 (ptr, value);
297- else if (len == 4 )
296+ else if constexpr (len == sizeof (SLONG) )
298297 put_vax_long (ptr, value);
299- else if (len == 2 )
298+ else if constexpr (len == sizeof (SSHORT) )
300299 put_vax_short (ptr, value);
301- else if (len == 1 )
300+ else if constexpr (len == sizeof ( char ) )
302301 *ptr = value;
302+ else
303+ static_assert (false , " unknown data type" );
303304
304305 ptr += len;
305306 return ptr;
You can’t perform that action at this time.
0 commit comments