Skip to content

Commit 79e89d2

Browse files
veqcctby-udel
authored andcommitted
fix(pointcloud_preprocessor): fix preprocessorErrorDirective (autowarefoundation#7786)
* fix(pointcloud_preprocessor): fix preprocessorErrorDirective Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * fix postfixOperator Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * remove unnecessary count() and contains() Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * restore bitness macros Signed-off-by: veqcc <ryuta.kambe@tier4.jp> * remove operator= Signed-off-by: veqcc <ryuta.kambe@tier4.jp> * remove addOrFree function Signed-off-by: veqcc <ryuta.kambe@tier4.jp> * add cppcheck suppression Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * add cppcheck suppression Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * add cppcheck suppression Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * add cppcheck suppression Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> --------- Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
1 parent c621727 commit 79e89d2

File tree

1 file changed

+9
-69
lines changed
  • sensing/pointcloud_preprocessor/src/downsample_filter

1 file changed

+9
-69
lines changed

sensing/pointcloud_preprocessor/src/downsample_filter/robin_hood.h

+9-69
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,8 @@ static Counts & counts()
126126
// bitness
127127
#if SIZE_MAX == UINT32_MAX
128128
#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 32
129-
#elif SIZE_MAX == UINT64_MAX
130-
#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 64
131129
#else
132-
#error Unsupported bitness
130+
#define ROBIN_HOOD_PRIVATE_DEFINITION_BITNESS() 64
133131
#endif
134132

135133
// endianess
@@ -165,12 +163,13 @@ static Counts & counts()
165163
#endif
166164
#include <intrin.h>
167165
#pragma intrinsic(ROBIN_HOOD(BITSCANFORWARD))
168-
#define ROBIN_HOOD_COUNT_TRAILING_ZEROES(x) \
169-
[](size_t mask) noexcept -> int { \
170-
unsigned long index; \ // NOLINT
171-
return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) ? static_cast<int>(index) \
172-
: ROBIN_HOOD(BITNESS); \
173-
}(x)
166+
#define ROBIN_HOOD_COUNT_TRAILING_ZEROES(x) \
167+
[](size_t mask) noexcept -> int { \
168+
unsigned long index; \ // NOLINT
169+
return ROBIN_HOOD(BITSCANFORWARD)(&index, mask) \ // NOLINT
170+
? static_cast<int>(index) \ // cppcheck-suppress syntaxError
171+
: ROBIN_HOOD(BITNESS); \ // cppcheck-suppress syntaxError
172+
}(x) // cppcheck-suppress syntaxError
174173
#else
175174
#if ROBIN_HOOD(BITNESS) == 32
176175
#define ROBIN_HOOD_PRIVATE_DEFINITION_CTZ() __builtin_ctzl
@@ -429,14 +428,6 @@ class BulkPoolAllocator
429428
return *this;
430429
}
431430

432-
BulkPoolAllocator &
433-
// NOLINTNEXTLINE (bugprone-unhandled-self-assignment,cert-oop54-cpp)
434-
operator=(const BulkPoolAllocator & ROBIN_HOOD_UNUSED(o) /*unused*/) noexcept
435-
{
436-
// does not do anything
437-
return *this;
438-
}
439-
440431
~BulkPoolAllocator() noexcept { reset(); }
441432

442433
// Deallocates all allocated memory.
@@ -475,22 +466,6 @@ class BulkPoolAllocator
475466
mHead = obj;
476467
}
477468

478-
// Adds an already allocated block of memory to the allocator. This allocator is from now on
479-
// responsible for freeing the data (with free()). If the provided data is not large enough to
480-
// make use of, it is immediately freed. Otherwise it is reused and freed in the destructor.
481-
void addOrFree(void * ptr, const size_t numBytes) noexcept
482-
{
483-
// calculate number of available elements in ptr
484-
if (numBytes < ALIGNMENT + ALIGNED_SIZE) {
485-
// not enough data for at least one element. Free and return.
486-
ROBIN_HOOD_LOG("std::free")
487-
std::free(ptr);
488-
} else {
489-
ROBIN_HOOD_LOG("add to buffer")
490-
add(ptr, numBytes);
491-
}
492-
}
493-
494469
void swap(BulkPoolAllocator<T, MinNumAllocs, MaxNumAllocs> & other) noexcept
495470
{
496471
using std::swap;
@@ -1382,7 +1357,7 @@ class Table
13821357
Iter & operator++() noexcept
13831358
{
13841359
mInfo++;
1385-
mKeyVals++;
1360+
++mKeyVals;
13861361
fastForward();
13871362
return *this;
13881363
}
@@ -2035,41 +2010,6 @@ class Table
20352010
return emplace(std::move(keyval)).first;
20362011
}
20372012

2038-
// Returns 1 if key is found, 0 otherwise.
2039-
size_t count(const key_type & key) const
2040-
{ // NOLINT (modernize-use-nodiscard)
2041-
ROBIN_HOOD_TRACE(this)
2042-
auto kv = mKeyVals + findIdx(key);
2043-
if (kv != reinterpret_cast_no_cast_align_warning<Node *>(mInfo)) {
2044-
return 1;
2045-
}
2046-
return 0;
2047-
}
2048-
2049-
template <typename OtherKey, typename Self_ = Self>
2050-
// NOLINTNEXTLINE (modernize-use-nodiscard)
2051-
typename std::enable_if<Self_::is_transparent, size_t>::type count(const OtherKey & key) const
2052-
{
2053-
ROBIN_HOOD_TRACE(this)
2054-
auto kv = mKeyVals + findIdx(key);
2055-
if (kv != reinterpret_cast_no_cast_align_warning<Node *>(mInfo)) {
2056-
return 1;
2057-
}
2058-
return 0;
2059-
}
2060-
2061-
bool contains(const key_type & key) const
2062-
{ // NOLINT (modernize-use-nodiscard)
2063-
return 1U == count(key);
2064-
}
2065-
2066-
template <typename OtherKey, typename Self_ = Self>
2067-
// NOLINTNEXTLINE (modernize-use-nodiscard)
2068-
typename std::enable_if<Self_::is_transparent, bool>::type contains(const OtherKey & key) const
2069-
{
2070-
return 1U == count(key);
2071-
}
2072-
20732013
// Returns a reference to the value found for key.
20742014
// Throws std::out_of_range if element cannot be found
20752015
template <typename Q = mapped_type>

0 commit comments

Comments
 (0)