AP_Math: use message with static assertion

This commit is contained in:
Andy Piper 2023-06-14 12:39:46 -04:00 committed by Peter Barker
parent d9869290ee
commit 1b10008e38
1 changed files with 3 additions and 3 deletions

View File

@ -531,7 +531,7 @@ int32_t double_to_int32(const double v)
int32_t float_to_int32_le(const float& value) int32_t float_to_int32_le(const float& value)
{ {
int32_t out; int32_t out;
static_assert(sizeof(value) == sizeof(out)); static_assert(sizeof(value) == sizeof(out), "mismatched sizes");
// Use memcpy because it's the most portable. // Use memcpy because it's the most portable.
// It might not be the fastest way on all hardware. // It might not be the fastest way on all hardware.
@ -543,7 +543,7 @@ int32_t float_to_int32_le(const float& value)
float int32_to_float_le(const uint32_t& value) float int32_to_float_le(const uint32_t& value)
{ {
float out; float out;
static_assert(sizeof(value) == sizeof(out)); static_assert(sizeof(value) == sizeof(out), "mismatched sizes");
// Use memcpy because it's the most portable. // Use memcpy because it's the most portable.
// It might not be the fastest way on all hardware. // It might not be the fastest way on all hardware.
@ -555,7 +555,7 @@ float int32_to_float_le(const uint32_t& value)
double uint64_to_double_le(const uint64_t& value) double uint64_to_double_le(const uint64_t& value)
{ {
double out; double out;
static_assert(sizeof(value) == sizeof(out)); static_assert(sizeof(value) == sizeof(out), "mismatched sizes");
// Use memcpy because it's the most portable. // Use memcpy because it's the most portable.
// It might not be the fastest way on all hardware. // It might not be the fastest way on all hardware.