mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-05 01:50:34 +08:00
Fixed C++11 support
This commit is contained in:
@@ -466,7 +466,7 @@ class YamlStreamer<Array<T, ArrayMode, MaxSize> >
|
||||
const int c = array.at(i);
|
||||
if (c < 32 || c > 126)
|
||||
{
|
||||
char nibbles[2] = {(c >> 4) & 0xF, c & 0xF};
|
||||
char nibbles[2] = {char((c >> 4) & 0xF), char(c & 0xF)};
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
nibbles[i] += '0';
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <math.h> // Needed for isfinite
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/marshal/type_util.hpp>
|
||||
#include <uavcan/marshal/integer_spec.hpp>
|
||||
#if __cplusplus > 201100
|
||||
# include <cmath>
|
||||
#else
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
@@ -137,6 +141,7 @@ public:
|
||||
private:
|
||||
static inline void saturate(StorageType& value)
|
||||
{
|
||||
using namespace std;
|
||||
if (!IsExactRepresentation && isfinite(value))
|
||||
{
|
||||
if (value > max())
|
||||
@@ -148,6 +153,7 @@ private:
|
||||
|
||||
static inline void truncate(StorageType& value)
|
||||
{
|
||||
using namespace std;
|
||||
if (!IsExactRepresentation && isfinite(value))
|
||||
{
|
||||
if (value > max())
|
||||
|
||||
@@ -142,7 +142,7 @@ TEST(BitStream, BitByBit)
|
||||
{
|
||||
const bool value = counter % 3 == 0;
|
||||
binary_string.push_back(value ? '1' : '0');
|
||||
const uint8_t data[] = { value << 7 };
|
||||
const uint8_t data[] = { uint8_t(value << 7) };
|
||||
ASSERT_EQ(1, bs_wr.write(data, 1));
|
||||
}
|
||||
binary_string.push_back(' ');
|
||||
|
||||
Reference in New Issue
Block a user