Skip to content

Commit

Permalink
1. BUG fix: the stable_integer_sort_new() function now works correctl…
Browse files Browse the repository at this point in the history
…y after removing dynamic bit_mask.
  • Loading branch information
fenilgmehta committed Jan 20, 2019
1 parent eb4d625 commit 7f923db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/integer_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace ir_sort {
// (updation: refer "ir_sort::parameter::set_BitShift_Iterations")
//REMOVE // int_fast32_t bit_mask;
//REMOVE // int_fast32_t sign_bit_mask;
int_fast32_t min_bits_shift, initial_bits_shift;
int_fast32_t min_bits_shift=8, initial_bits_shift;

/*
* This will fill "box" with 0
Expand All @@ -64,7 +64,7 @@ namespace ir_sort {
*
* */
inline void update_initial_bits_shift() {
initial_bits_shift += min_bits_shift;
initial_bits_shift += 8;
}

/*
Expand Down
8 changes: 6 additions & 2 deletions test/temp_raw_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ int32_t main() {
int64_t timeArrIndex = 0;

m_START_TIME
ir_sort::integer_sort(m_ALL(arr), true, 0);
// ir_sort::integer_sort(m_ALL(arr), true);
ir_sort::stable_integer_sort_new(m_ALL(arr), true, 3); // better
m_END_TIME
timeArr[timeArrIndex++] = duration.count();
if (!isSorted(begin(arr)+myTempLow, begin(arr)+myTempHigh)) cerr << endl << "ERROR: array \""<<timeArrIndex<<"\" not sorted :(";
Expand All @@ -244,7 +245,10 @@ int32_t main() {
// if (!isSorted(&arr[0], myTempLow, myTempHigh)) cerr << endl << "ERROR: array \""<<timeArrIndex<<"\" not sorted :(";

m_START_TIME
ska_sort(m_ALL(arr));
// ska_sort(m_ALL(arr));
auto *buffer = new ArrayDataType[arrayLength];
detail::SizedRadixSorter<8>::sort(m_ALL(arr), buffer, [](ArrayDataType &a){return a;});
delete[] buffer;
m_END_TIME
timeArr[timeArrIndex++] = duration.count();
// if (!isSorted(&arr[0], myTempLow, myTempHigh)) cerr << endl << "ERROR: array \""<<timeArrIndex<<"\" not sorted :(";
Expand Down

0 comments on commit 7f923db

Please sign in to comment.