Update reference code
This commit is contained in:
parent
e4d45e470c
commit
75efe84317
11
bucksort.cpp
11
bucksort.cpp
@ -13,6 +13,8 @@ bool LT(int a, int b)
|
||||
return a < b;
|
||||
}
|
||||
|
||||
// TODO: parallellize rotate-left instruction (BSL)
|
||||
// This can be done by partially unrolling the loop ;)
|
||||
// Bucket/Insertion sort (except final merge). C-style pseudocode
|
||||
void bi_sort(short *data){
|
||||
short *buckets;
|
||||
@ -43,15 +45,16 @@ void bi_sort(short *data){
|
||||
|
||||
while(lc_ != 0){
|
||||
++pc_;
|
||||
hr = data[pc_];
|
||||
if(hr > gr){
|
||||
ar = data[pc_];
|
||||
if((ar -= gr) < 0){
|
||||
ar += gr;
|
||||
data[pc_] = gr;
|
||||
// Insert here
|
||||
while(lc_ != 0){
|
||||
++pc_;
|
||||
gr = data[pc_];
|
||||
data[pc_] = hr;
|
||||
hr = gr;
|
||||
data[pc_] = ar;
|
||||
ar = gr;
|
||||
--lc_;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user