mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Fixed typedef reuse
This commit is contained in:
parent
2eb15268f7
commit
c4c77ea321
@ -50,10 +50,12 @@ public:
|
||||
static typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType
|
||||
toIeee(typename NativeFloatSelector<BitLen>::Type value)
|
||||
{
|
||||
typedef typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType IntType;
|
||||
typedef typename NativeFloatSelector<BitLen>::Type FloatType;
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen>::check();
|
||||
union { IntType i; FloatType f; } u;
|
||||
union
|
||||
{
|
||||
typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType i;
|
||||
typename NativeFloatSelector<BitLen>::Type f;
|
||||
} u;
|
||||
StaticAssert<sizeof(u.f) * 8 == BitLen>::check();
|
||||
u.f = value;
|
||||
return u.i;
|
||||
}
|
||||
@ -62,10 +64,12 @@ public:
|
||||
static typename NativeFloatSelector<BitLen>::Type
|
||||
toNative(typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType value)
|
||||
{
|
||||
typedef typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType IntType;
|
||||
typedef typename NativeFloatSelector<BitLen>::Type FloatType;
|
||||
StaticAssert<sizeof(FloatType) * 8 == BitLen>::check();
|
||||
union { IntType i; FloatType f; } u;
|
||||
union
|
||||
{
|
||||
typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType i;
|
||||
typename NativeFloatSelector<BitLen>::Type f;
|
||||
} u;
|
||||
StaticAssert<sizeof(u.f) * 8 == BitLen>::check();
|
||||
u.i = value;
|
||||
return u.f;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::regist(DataTypeID i
|
||||
return RegistResultFrozen;
|
||||
}
|
||||
|
||||
static union EntryUnion
|
||||
static union
|
||||
{
|
||||
uint8_t buffer[sizeof(Entry)];
|
||||
long long _aligner_1;
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
virtual uavcan::MonotonicTime getMonotonic() const
|
||||
{
|
||||
struct timespec ts;
|
||||
timespec ts;
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
|
||||
{
|
||||
throw Exception("Failed to get monotonic time");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user