#include <radix_sorter.hpp>
|
template<data_type TDataType, typename TFunc > |
void | sort (T *src, int num, const TFunc &func, T *help_buffer) |
|
template<data_type TDataType, typename TFunc > |
void | sort (T *src, int num, const TFunc &func) |
|
template<typename T>
class std::radix_sorter< T >
◆ data_type
Aufzählungswerte |
---|
data_unsigned | |
data_signed | |
Definition: radix_sorter.hpp:46
Definition: radix_sorter.hpp:47
◆ sort() [1/2]
template<typename T >
template<data_type TDataType, typename TFunc >
void std::radix_sorter< T >::sort |
( |
T * |
src, |
|
|
int |
num, |
|
|
const TFunc & |
func, |
|
|
T * |
help_buffer |
|
) |
| |
|
inline |
62 bool alreadySorted(
true);
63 uint32_t prevValue = func(src[0]);
66 for (
int i = 0; i < num; ++i)
69 const uint32_t x = func(src[i]);
70 if (alreadySorted && x < prevValue)
72 alreadySorted =
false;
75 const uint8_t* px = (
const uint8_t*)&x;
89 const uint32_t x = func(src[k]);
90 const uint8_t* px = (
const uint8_t*)&x;
98 const bool canBreakAfter16Bits = (h2[0] == (uint32_t)num && h3[0] == (uint32_t)num);
99 (void)canBreakAfter16Bits;
102 calculate_offsets_signed(histogram);
104 calculate_offsets(histogram);
106 for (
int i = 0; i < num; ++i)
108 const uint32_t pos = func(src[i]) & 0xFF;
109 help_buffer[histogram[pos]++] = src[i];
112 for (
int i = 0; i < num; ++i)
114 const uint32_t pos = (func(m_dst[i]) >> 8) & 0xFF;
115 src[h1[pos]++] = help_buffer[i];
121 for (
int i = 0; i < num; ++i)
123 const uint32_t pos = (func(src[i]) >> 16) & 0xFF;
124 help_buffer[h2[pos]++] = src[i];
127 for (
int i = 0; i < num; ++i)
129 const uint32_t pos = (func(m_dst[i]) >> 24) & 0xFF;
130 src[h3[pos]++] = help_buffer[i];
Definition: radix_sorter.hpp:46
Definition: radix_sorter.hpp:47
static void MemSet(void *buf, unsigned char value, size_t bytes)
Definition: PLATFORM.cpp:47
static const size_t kHistogramSize
Definition: radix_sorter.hpp:42
◆ sort() [2/2]
template<typename T >
template<data_type TDataType, typename TFunc >
137 if (num > m_dst.
size())
139 sort<TDataType, TFunc>(src, num, func, m_dst.
begin());
size_type size() const
Definition: vector.hpp:197
iterator begin()
Definition: vector.hpp:181
◆ kHistogramSize
Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: