MCPcopy Create free account
hub / github.com/ParAlg/gbbs / seq_radix_sort

Function seq_radix_sort

pbbslib/integer_sort.h:67–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65// In and Tmp can be the same, but Out must be different
66template <class SeqIn, class Slice, class GetKey>
67void seq_radix_sort(SeqIn const &In, Slice Out, Slice Tmp, GetKey const &g,
68 size_t key_bits, bool inplace = true) {
69 bool odd = ((key_bits - 1) / radix) & 1;
70 size_t n = In.size();
71 if (slice_eq(In.slice(), Tmp)) { // inplace
72 seq_radix_sort_(Tmp.slice(), Out, g, key_bits, inplace);
73 } else {
74 if (odd) {
75 for (size_t i = 0; i < n; i++) move_uninitialized(Tmp[i], In[i]);
76 seq_radix_sort_(Tmp, Out, g, key_bits, false);
77 } else {
78 for (size_t i = 0; i < n; i++) move_uninitialized(Out[i], In[i]);
79 seq_radix_sort_(Out, Tmp, g, key_bits, true);
80 }
81 }
82}
83
84// a top down recursive radix sort
85// g extracts the integer keys from In

Callers 1

integer_sort_rFunction · 0.85

Calls 5

slice_eqFunction · 0.85
seq_radix_sort_Function · 0.85
move_uninitializedFunction · 0.70
sizeMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected