Partially removed all references to STL's algorithm. <algorithm> is not included anywhere, though still used in several places which still alows the code to compile as <algorithm> is being pulled in from some other standard headers.

This commit is contained in:
Pavel Kirienko
2014-05-04 21:22:18 +04:00
parent d0c2898def
commit 0db43b6489
13 changed files with 10 additions and 16 deletions
-1
View File
@@ -6,7 +6,6 @@
#include <cassert>
#include <cstring>
#include <algorithm>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/transport/transfer.hpp>
-1
View File
@@ -6,7 +6,6 @@
#pragma once
#include <cassert>
#include <algorithm>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/driver/system_clock.hpp>
+9 -4
View File
@@ -7,7 +7,6 @@
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <limits>
#include <uavcan/stdint.hpp>
#include <uavcan/util/compile_time.hpp>
@@ -38,11 +37,17 @@ class UAVCAN_EXPORT PoolManager : public IPoolAllocator, Noncopyable
{
IPoolAllocator* pools_[MaxPools];
static bool sortComparePoolAllocators(const IPoolAllocator* a, const IPoolAllocator* b)
static int qsortComparePoolAllocators(const void* raw_a, const void* raw_b)
{
const IPoolAllocator* const a = *static_cast<const IPoolAllocator* const*>(raw_a);
const IPoolAllocator* const b = *static_cast<const IPoolAllocator* const*>(raw_b);
const std::size_t a_size = a ? a->getBlockSize() : std::numeric_limits<std::size_t>::max();
const std::size_t b_size = b ? b->getBlockSize() : std::numeric_limits<std::size_t>::max();
return a_size < b_size;
if (a_size != b_size)
{
return (a_size > b_size) ? 1 : -1;
}
return 0;
}
public:
@@ -144,7 +149,7 @@ bool PoolManager<MaxPools>::addPool(IPoolAllocator* pool)
}
}
// We need to keep the pools in order, so that smallest blocks go first
std::sort(pools_, pools_ + MaxPools, &PoolManager::sortComparePoolAllocators);
std::qsort(pools_, MaxPools, sizeof(IPoolAllocator*), &PoolManager::qsortComparePoolAllocators);
return retval;
}
@@ -6,7 +6,6 @@
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <uavcan/error.hpp>
@@ -5,7 +5,6 @@
#pragma once
#include <cassert>
#include <algorithm>
#include <uavcan/error.hpp>
#include <uavcan/stdint.hpp>
#include <uavcan/data_type.hpp>
-1
View File
@@ -4,7 +4,6 @@
#pragma once
#include <algorithm>
#include <limits>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
@@ -5,7 +5,6 @@
#pragma once
#include <cassert>
#include <algorithm>
#include <uavcan/transport/transfer.hpp>
#include <uavcan/transport/can_io.hpp>
#include <uavcan/impl_constants.hpp>
@@ -4,7 +4,6 @@
#pragma once
#include <algorithm>
#include <limits>
#include <uavcan/stdint.hpp>
#include <uavcan/error.hpp>
@@ -5,7 +5,6 @@
#pragma once
#include <cassert>
#include <algorithm>
#include <uavcan/error.hpp>
#include <uavcan/stdint.hpp>
#include <uavcan/transport/transfer_receiver.hpp>
+1 -1
View File
@@ -82,7 +82,7 @@ uint16_t IEEE754Converter::nativeNonIeeeToHalf(float value)
hbits |= ((exp + 14) << 10);
}
const int32_t ival = static_cast<int32_t>(value);
hbits |= static_cast<uint16_t>(std::abs(ival) & 0x3FFU);
hbits |= static_cast<uint16_t>(((ival < 0) ? (-ival) : ival) & 0x3FFU);
float diff = std::abs(value - static_cast<float>(ival));
hbits += diff >= 0.5F;
return hbits;
@@ -4,7 +4,6 @@
#include <uavcan/protocol/node_status_monitor.hpp>
#include <uavcan/debug.hpp>
#include <algorithm>
#include <cassert>
#include <cstdlib>
-1
View File
@@ -5,7 +5,6 @@
#include <uavcan/transport/can_io.hpp>
#include <uavcan/debug.hpp>
#include <algorithm>
#include <cassert>
#include <limits>
@@ -7,7 +7,6 @@
#include <uavcan/debug.hpp>
#include <cstdlib>
#include <cassert>
#include <algorithm>
namespace uavcan
{