mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 07:03:33 +08:00
More compliance fixes
This commit is contained in:
@@ -52,7 +52,7 @@ public:
|
||||
{
|
||||
typedef typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType IntType;
|
||||
typedef typename NativeFloatSelector<BitLen>::Type FloatType;
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen && std::numeric_limits<FloatType>::is_iec559>::check();
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen>::check();
|
||||
union { IntType i; FloatType f; } u;
|
||||
u.f = value;
|
||||
return u.i;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
{
|
||||
typedef typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType IntType;
|
||||
typedef typename NativeFloatSelector<BitLen>::Type FloatType;
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen && std::numeric_limits<FloatType>::is_iec559>::check();
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen>::check();
|
||||
union { IntType i; FloatType f; } u;
|
||||
u.i = value;
|
||||
return u.f;
|
||||
|
||||
@@ -126,7 +126,7 @@ int ScalarCodec::decode(T& value)
|
||||
if (read_res > 0)
|
||||
{
|
||||
convertByteOrder<BitLen>(byte_union.bytes);
|
||||
fixTwosComplement<BitLen>(byte_union.value);
|
||||
fixTwosComplement<BitLen, T>(byte_union.value);
|
||||
value = byte_union.value;
|
||||
}
|
||||
return read_res;
|
||||
|
||||
Reference in New Issue
Block a user