BitSorter.hpp
A quick series of comparisons intended for sorting bits.
-
class BitSorter
- #include <BitSorter.hpp>
Public Types
-
using bits_t = uint32_t
Type used to represent pairs if positions as bit masks.
Public Functions
-
inline BitSorter()
-
inline ~BitSorter()
-
inline size_t GetSize() const
How many comparators are in this sorting network.
-
inline size_t size() const
-
inline void Clear()
-
inline void CalcDepth(size_t num_bits, vector<size_t> &depth_vals) const
If this network is compressed as far as possible, what will the max depth of each position be?
-
inline size_t CalcDepth(size_t num_bits = 16) const
Return only the highest overall depth of the sorting network.
-
inline bool AddCompare(size_t id1, size_t id2)
Push a new comparator onto the back of the list.
-
inline bool EditCompare(size_t pos, size_t id1, size_t id2)
Change the positions compared in a specified comparator.
-
inline bool InsertCompare(size_t pos, size_t id1, size_t id2)
Insert a new comparator at the specified position.
-
inline bool RemoveCompare(size_t pos)
Remove the comparator at the specified position.
-
inline bits_t Sort(bits_t values) const
Run a specific set of bit values through the series of comparators in this sorting network.
-
inline bool TestSortable(bits_t values) const
Determine if a particular input bit pattern will be sorted correctly by this network.
-
inline size_t CountSortable(size_t num_bits = 16) const
Try all possible bit sequences (with the specified number of bits) and count how many this sorting network fully sorts.
-
using bits_t = uint32_t