diff --git a/include/macros.h b/include/macros.h index ead8d6b..e4ada05 100644 --- a/include/macros.h +++ b/include/macros.h @@ -209,6 +209,7 @@ static_assert_eq(bswap(bswap(128lu)), 128, "bswap128 (lu) failed (3)"); // Transmute #define TRANSMUTE(val, type) ({ union _trans { var(val) input; type output; }; \ + _Static_assert(sizeof(var(val)) == sizeof(type), "Cannot transmute values of different sizes"); \ _Static_assert(sizeof(union _trans) == sizeof(type), "Cannot transmute values of different sizes"); \ /* XXX: Do we need do check this for equality? Can we re-word it or do we even need it at all? _Static_assert(_Alignof(union _trans) == _Alignof(type), "Cannot transmute values of different alignments");*/ \ union _trans _trans__value = { .input = (val), }; \