Removed enable_tail_array_optimization and init()

This commit is contained in:
Pavel Kirienko
2014-02-22 17:08:38 +04:00
parent a58e8842e2
commit fb32aabb54
6 changed files with 22 additions and 16 deletions
@@ -9,6 +9,15 @@
namespace uavcan
{
/**
* UAVCAN can be explicitly told to ignore exceptions, or it can be detected automatically.
*/
#ifndef UAVCAN_EXCEPTIONS
# if defined(__EXCEPTIONS) || defined(_HAS_EXCEPTIONS)
# define UAVCAN_EXCEPTIONS 1
# endif
#endif
/**
* Should be OK for any target arch up to AMD64 and any compiler.
* The library leverages compile-time checks to ensure that all types that are subject to dynamic allocation
@@ -107,12 +107,10 @@ public:
using IEEE754Limits<BitLen>::max;
using IEEE754Limits<BitLen>::epsilon;
static StorageType init() { return 0.0; }
static std::float_round_style roundstyle() { return IEEE754Converter::roundstyle(); }
static int encode(StorageType value, ScalarCodec& codec, bool enable_tail_array_optimization = false)
static int encode(StorageType value, ScalarCodec& codec)
{
(void)enable_tail_array_optimization;
// cppcheck-suppress duplicateExpression
if (CastMode == CastModeSaturate)
saturate(value);
@@ -121,9 +119,8 @@ public:
return codec.encode<BitLen>(IEEE754Converter::toIeee<BitLen>(value));
}
static int decode(StorageType& out_value, ScalarCodec& codec, bool enable_tail_array_optimization = false)
static int decode(StorageType& out_value, ScalarCodec& codec)
{
(void)enable_tail_array_optimization;
typename IntegerSpec<BitLen, SignednessUnsigned, CastModeTruncate>::StorageType ieee = 0;
const int res = codec.decode<BitLen>(ieee);
if (res <= 0)
@@ -77,11 +77,8 @@ public:
// cppcheck-suppress duplicateExpression
static StorageType min() { return Limits::min(); }
static StorageType init() { return 0; }
static int encode(StorageType value, ScalarCodec& codec, bool enable_tail_array_optimization = false)
static int encode(StorageType value, ScalarCodec& codec)
{
(void)enable_tail_array_optimization;
// cppcheck-suppress duplicateExpression
if (CastMode == CastModeSaturate)
saturate(value);
@@ -90,9 +87,8 @@ public:
return codec.encode<BitLen>(value);
}
static int decode(StorageType& out_value, ScalarCodec& codec, bool enable_tail_array_optimization = false)
static int decode(StorageType& out_value, ScalarCodec& codec)
{
(void)enable_tail_array_optimization;
return codec.decode<BitLen>(out_value);
}
};
@@ -64,4 +64,11 @@ struct StaticIf<false, TrueType, FalseType>
};
template<bool> struct BooleanType { };
typedef BooleanType<true> TrueType;
typedef BooleanType<false> FalseType;
}
/// Ensure that conditional comilation macros are present
#include <uavcan/internal/impl_constants.hpp>