mirror of
https://github.com/boostorg/sort.git
synced 2026-01-19 04:42:11 +00:00
Correction of the error with and or not
This commit is contained in:
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
clang++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_numbers
|
||||
clang++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_numbers
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
clang++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_objects
|
||||
clang++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_objects
|
||||
echo "."
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 60 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_strings
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_strings
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_numbers
|
||||
g++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_numbers
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_objects
|
||||
g++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_objects
|
||||
echo "."
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 60 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_strings
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -pthread -s -lpthread -o benchmark_strings
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
clang++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_numbers
|
||||
clang++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_numbers
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
clang++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_objects
|
||||
clang++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_objects
|
||||
echo "."
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 45 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
clang++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
clang++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_strings
|
||||
clang++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_strings
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_numbers
|
||||
g++ ./benchmark_numbers.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_numbers
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_objects
|
||||
g++ ./benchmark_objects.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_objects
|
||||
echo "."
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 45 minutes depending of your machine )"
|
||||
|
||||
@@ -7,9 +7,9 @@ echo "=================================================================="
|
||||
echo "."
|
||||
echo "C O M P I L I N G . . . . . . . . . . ."
|
||||
echo "."
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
g++ ./file_generator.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o file_generator
|
||||
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-exceptions -fno-operator-names -O3 -I../../include -s -o benchmark_strings
|
||||
g++ ./benchmark_strings.cpp -std=c++11 -march=native -w -fno-operator-names -O3 -I../../include -s -o benchmark_strings
|
||||
|
||||
echo "R U N N I N G . . . . . . . . . . ."
|
||||
echo "( The time needed is around 10 minutes depending of your machine )"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BACKBONE_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BACKBONE_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BLOCK_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BLOCK_HPP
|
||||
|
||||
#include <ciso646>
|
||||
|
||||
#include <boost/sort/common/range.hpp>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_MERGE_BLOCKS_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_MERGE_BLOCKS_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
@@ -99,7 +98,7 @@ struct merge_blocks
|
||||
bscu::atomic_add(counter, 1);
|
||||
function_t f1 = [this, rng_input, &counter, &error]( ) -> void
|
||||
{
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -134,7 +133,7 @@ struct merge_blocks
|
||||
bscu::atomic_add(counter, 1);
|
||||
function_t f1 = [this, rng_input, &counter, &error]( ) -> void
|
||||
{
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -183,7 +182,7 @@ merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
{
|
||||
size_t nblock1 = pos_index2 - pos_index1;
|
||||
size_t nblock2 = pos_index3 - pos_index2;
|
||||
if (nblock1 == 0 or nblock2 == 0) return;
|
||||
if (nblock1 == 0 || nblock2 == 0) return;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Merging of the two intervals
|
||||
@@ -205,7 +204,7 @@ merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
// tail process
|
||||
//-------------------------------------------------------------------
|
||||
if (vpos2.back().pos() == (bk.nblock - 1)
|
||||
and bk.range_tail.first != bk.range_tail.last)
|
||||
&& bk.range_tail.first != bk.range_tail.last)
|
||||
{
|
||||
tail_process(vpos1, vpos2);
|
||||
nblock1 = vpos1.size();
|
||||
@@ -236,7 +235,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
::tail_process( std::vector<block_pos> &vblkpos1,
|
||||
std::vector<block_pos> &vblkpos2 )
|
||||
{
|
||||
if (vblkpos1.size() == 0 or vblkpos2.size() == 0) return;
|
||||
if (vblkpos1.size() == 0 || vblkpos2.size() == 0) return;
|
||||
|
||||
vblkpos2.pop_back();
|
||||
|
||||
@@ -291,7 +290,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
{
|
||||
size_t pos = pos_ini + size_part;
|
||||
while (pos < pos_last
|
||||
and bk.index[pos - 1].side() == bk.index[pos].side())
|
||||
&& bk.index[pos - 1].side() == bk.index[pos].side())
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
@@ -377,16 +376,16 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
bool final = (posx == range_input.last);
|
||||
bool mergeable = false;
|
||||
|
||||
if (not final)
|
||||
if (! final)
|
||||
{
|
||||
bp_posx = bk.index[posx];
|
||||
rng_posx = bk.get_range(bp_posx.pos());
|
||||
side_posx = bp_posx.side();
|
||||
mergeable = (side_max != side_posx
|
||||
and is_mergeable(rng_max, rng_posx, bk.cmp));
|
||||
&& is_mergeable(rng_max, rng_posx, bk.cmp));
|
||||
}
|
||||
if (bk.error) return;
|
||||
if (final or not mergeable)
|
||||
if (final || ! mergeable)
|
||||
{
|
||||
range_pos rp_final(posx_ini, posx);
|
||||
if (rp_final.size() > 1)
|
||||
@@ -401,7 +400,7 @@ void merge_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
}
|
||||
}
|
||||
posx_ini = posx;
|
||||
if (not final)
|
||||
if (! final)
|
||||
{
|
||||
rng_max = rng_posx;
|
||||
side_max = side_posx;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_MOVE_BLOCKS_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <ciso646>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
@@ -86,7 +85,7 @@ struct move_blocks
|
||||
bscu::atomic_add(counter, 1);
|
||||
function_t f1 = [this, sequence, &counter, &error]( ) -> void
|
||||
{
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -121,7 +120,7 @@ struct move_blocks
|
||||
bscu::atomic_add(counter, 1);
|
||||
function_t f1 = [this, sequence, &counter, &error]( ) -> void
|
||||
{
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -169,7 +168,7 @@ move_blocks<Block_size, Group_size, Iter_t, Compare>
|
||||
while (pos_index_ini < bk.index.size())
|
||||
{
|
||||
while (pos_index_ini < bk.index.size()
|
||||
and bk.index[pos_index_ini].pos() == pos_index_ini)
|
||||
&& bk.index[pos_index_ini].pos() == pos_index_ini)
|
||||
{
|
||||
++pos_index_ini;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <boost/sort/block_indirect_sort/blk_detail/backbone.hpp>
|
||||
#include <boost/sort/pdqsort/pdqsort.hpp>
|
||||
#include <boost/sort/common/pivot.hpp>
|
||||
@@ -94,7 +93,7 @@ struct parallel_sort
|
||||
bscu::atomic_add(counter, 1);
|
||||
function_t f1 = [this, first, last, level, &counter, &error]( )
|
||||
{
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -141,13 +140,13 @@ parallel_sort<Block_size, Iter_t, Compare>
|
||||
//------------------- check if sort --------------------------------------
|
||||
bool sorted = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sorted = not bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sorted = ! bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
if (sorted) return;
|
||||
|
||||
//------------------- check if reverse sort ---------------------------
|
||||
sorted = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sorted = not bk.cmp(*it1, *it2)); it1 = it2++);
|
||||
it2 != last && (sorted = ! bk.cmp(*it1, *it2)); it1 = it2++);
|
||||
|
||||
if (sorted)
|
||||
{
|
||||
@@ -171,7 +170,7 @@ parallel_sort<Block_size, Iter_t, Compare>
|
||||
pdqsort(first, last, bk.cmp);
|
||||
return;
|
||||
}
|
||||
if (not bk.error) divide_sort(first, last, level);
|
||||
if (! bk.error) divide_sort(first, last, level);
|
||||
|
||||
// wait until all the parts are finished
|
||||
bk.exec(counter);
|
||||
@@ -193,12 +192,12 @@ void parallel_sort<Block_size, Iter_t, Compare>
|
||||
//------------------- check if sort -----------------------------------
|
||||
bool sorted = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sorted = not bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sorted = ! bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
if (sorted) return;
|
||||
|
||||
//---------------- check if finish the subdivision -------------------
|
||||
size_t nelem = last - first;
|
||||
if (level == 0 or nelem < (max_per_thread))
|
||||
if (level == 0 || nelem < (max_per_thread))
|
||||
{
|
||||
return pdqsort(first, last, bk.cmp);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_BLOCK_INDIRECT_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_BLOCK_INDIRECT_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <future>
|
||||
@@ -201,14 +200,14 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
|
||||
//------------------- check if sort -----------------------------------
|
||||
bool sorted = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1; it2 != last and (sorted =
|
||||
not bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
for (Iter_t it1 = first, it2 = first + 1; it2 != last && (sorted =
|
||||
! bk.cmp(*it2, *it1)); it1 = it2++);
|
||||
if (sorted) return;
|
||||
|
||||
//------------------- check if reverse sort ---------------------------
|
||||
sorted = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1; it2 != last and (sorted =
|
||||
not bk.cmp(*it1, *it2)); it1 = it2++);
|
||||
for (Iter_t it1 = first, it2 = first + 1; it2 != last && (sorted =
|
||||
! bk.cmp(*it1, *it2)); it1 = it2++);
|
||||
|
||||
if (sorted)
|
||||
{
|
||||
@@ -230,7 +229,7 @@ block_indirect_sort<Block_size, Group_size, Iter_t, Compare>
|
||||
if (nbits_size > 5) nbits_size = 5;
|
||||
size_t max_per_thread = (size_t) 1 << (18 - nbits_size);
|
||||
|
||||
if (nelem < (max_per_thread) or nthread < 2)
|
||||
if (nelem < (max_per_thread) || nthread < 2)
|
||||
{
|
||||
//intro_sort (first, last, bk.cmp);
|
||||
pdqsort(first, last, bk.cmp);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __TOOLS_DEQUE_CNC_HPP
|
||||
#define __TOOLS_DEQUE_CNC_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <ios>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ciso646>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
@@ -230,7 +229,7 @@ struct uint64_file_generator
|
||||
{ //---------------------------- begin ---------------------------------
|
||||
s = filename;
|
||||
input.open(filename, std::ios_base::in | std::ios_base::binary);
|
||||
if (input.fail() or input.bad())
|
||||
if (input.fail() || input.bad())
|
||||
{
|
||||
throw std::ios_base::failure("could not open file \n");
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_COMMON_INDIRECT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_COMMON_INDIRECT_HPP
|
||||
|
||||
//#include <boost/sort/common/atomic.hpp>
|
||||
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_INT_ARRAY_HPP
|
||||
#define __BOOST_SORT_COMMON_INT_ARRAY_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ void merge_block<Iter_t, Compare, Power2>
|
||||
{ // The list B is finished
|
||||
rngA = get_range(*itxA);
|
||||
if (ntail != 0 && indexB.back() == (nblock - 1)) // exist tail
|
||||
{ // add the tail block to indexA, and shift the element
|
||||
{ // add the tail block to indexA, && shift the element
|
||||
indexA.push_back(indexB.back());
|
||||
size_t numA = size_t(itA - rngA.first);
|
||||
ptr_circ->pop_move_back(rngA.first, numA);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_FOUR_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_FOUR_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
@@ -56,7 +55,7 @@ inline bool less_range(Iter_t it1, uint32_t pos1, Iter_t it2, uint32_t pos2,
|
||||
Compare comp = Compare())
|
||||
{
|
||||
return (comp(*it1, *it2)) ? true :
|
||||
(pos2 < pos1) ? false : not (comp(*it2, *it1));
|
||||
(pos2 < pos1) ? false : ! (comp(*it2, *it1));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -123,7 +122,7 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
{
|
||||
swap(pos[0], pos[1]);
|
||||
}
|
||||
if (npos == 4 and less_range(vrange_input[pos[3]].first, pos[3],
|
||||
if (npos == 4 && less_range(vrange_input[pos[3]].first, pos[3],
|
||||
vrange_input[pos[2]].first, pos[2], comp))
|
||||
{
|
||||
swap(pos[3], pos[2]);
|
||||
@@ -134,7 +133,7 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
swap(pos[0], pos[2]);
|
||||
};
|
||||
if (npos == 4
|
||||
and less_range (vrange_input[pos[3]].first, pos[3],
|
||||
&& less_range (vrange_input[pos[3]].first, pos[3],
|
||||
vrange_input[pos[1]].first, pos[1], comp))
|
||||
{
|
||||
swap(pos[1], pos[3]);
|
||||
@@ -167,7 +166,7 @@ range<Iter1_t> full_merge4(const range<Iter1_t> &rdest,
|
||||
{
|
||||
swap(pos[1], pos[2]);
|
||||
if (npos == 4
|
||||
and less_range(vrange_input[pos[3]].first,
|
||||
&& less_range(vrange_input[pos[3]].first,
|
||||
pos[3],
|
||||
vrange_input[pos[2]].first,
|
||||
pos[2], comp))
|
||||
@@ -252,7 +251,7 @@ range<Value_t *> uninit_full_merge4(const range<Value_t *> &dest,
|
||||
{
|
||||
swap(pos[0], pos[1]);
|
||||
};
|
||||
if (npos == 4 and less_range(vrange_input[pos[3]].first, pos[3],
|
||||
if (npos == 4 && less_range(vrange_input[pos[3]].first, pos[3],
|
||||
vrange_input[pos[2]].first, pos[2], comp))
|
||||
{
|
||||
swap(pos[3], pos[2]);
|
||||
@@ -262,7 +261,7 @@ range<Value_t *> uninit_full_merge4(const range<Value_t *> &dest,
|
||||
{
|
||||
swap(pos[0], pos[2]);
|
||||
};
|
||||
if (npos == 4 and less_range(vrange_input[pos[3]].first, pos[3],
|
||||
if (npos == 4 && less_range(vrange_input[pos[3]].first, pos[3],
|
||||
vrange_input[pos[1]].first, pos[1], comp))
|
||||
{
|
||||
swap(pos[1], pos[3]);
|
||||
@@ -295,7 +294,7 @@ range<Value_t *> uninit_full_merge4(const range<Value_t *> &dest,
|
||||
vrange_input[pos[1]].first, pos[1], comp))
|
||||
{
|
||||
swap(pos[1], pos[2]);
|
||||
if (npos == 4 and less_range(vrange_input[pos[3]].first,
|
||||
if (npos == 4 && less_range(vrange_input[pos[3]].first,
|
||||
pos[3],
|
||||
vrange_input[pos[2]].first,
|
||||
pos[2], comp))
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_VECTOR_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_MERGE_VECTOR_HPP
|
||||
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_PIVOT_HPP
|
||||
#define __BOOST_SORT_COMMON_PIVOT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_SCHEDULER_HPP
|
||||
#define __BOOST_SORT_COMMON_SCHEDULER_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <scoped_allocator>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -232,7 +231,7 @@ struct scheduler
|
||||
if (nelem == 0) return false;
|
||||
key_t th_id = std::this_thread::get_id();
|
||||
it_map itmp = mp.find(th_id);
|
||||
if (itmp != mp.end() and not itmp->second.empty())
|
||||
if (itmp != mp.end() && ! itmp->second.empty())
|
||||
{
|
||||
f = std::move(itmp->second.back());
|
||||
itmp->second.pop_back();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_SPINLOCK_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_SPINLOCK_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <atomic>
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_STACK_CNC_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_STACK_CNC_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <vector>
|
||||
#include <boost/sort/common/spinlock.hpp>
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
|
||||
#define __BOOST_SORT_PARALLEL_TOOLS_TIME_MEASURE_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <chrono>
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_ALGORITHM_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_ALGORITHM_HPP
|
||||
|
||||
#include <ciso646>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_UTIL_ATOMIC_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_UTIL_ATOMIC_HPP
|
||||
|
||||
#include <ciso646>
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_CIRCULAR_BUFFER_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_CIRCULAR_BUFFER_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_INSERT_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_INSERT_HPP
|
||||
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef __BOOST_SORT_COMMON_SEARCH_HPP
|
||||
#define __BOOST_SORT_COMMON_SEARCH_HPP
|
||||
|
||||
#include <ciso646>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/sort/common/util/traits.hpp>
|
||||
|
||||
@@ -195,7 +195,7 @@ inline Iter_t lower_bound(Iter_t first, Iter_t last,
|
||||
assert((last - first) >= 0);
|
||||
if (last == first) return last;
|
||||
Iter_t itaux = internal_find_first(first, last, val, comp, flt);
|
||||
return (itaux == (last - 1) and comp(flt(*itaux), val)) ? last : itaux;
|
||||
return (itaux == (last - 1) && comp(flt(*itaux), val)) ? last : itaux;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
// function :upper_bound
|
||||
@@ -219,7 +219,7 @@ inline Iter_t upper_bound(Iter_t first, Iter_t last,
|
||||
assert((last - first) >= 0);
|
||||
if (last == first) return last;
|
||||
Iter_t itaux = internal_find_last(first, last, val, comp, flt);
|
||||
return (itaux == first and comp(val, flt(*itaux))) ? itaux : itaux + 1;
|
||||
return (itaux == first && comp(val, flt(*itaux))) ? itaux : itaux + 1;
|
||||
}
|
||||
;
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -287,239 +287,7 @@ inline Iter_t insert_last(Iter_t first, Iter_t last,
|
||||
return upper_bound(first, last, val, comp, flt);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
//
|
||||
//###########################################################################
|
||||
// ##
|
||||
// ################################################################ ##
|
||||
// # # ##
|
||||
// # I N T E R N A L F U N C T I O N S # ##
|
||||
// # # ##
|
||||
// ################################################################ ##
|
||||
// ##
|
||||
// I M P O R T A N T ##
|
||||
// ##
|
||||
// These functions are not directly callable by the user, are for internal ##
|
||||
// use only. ##
|
||||
// These functions don't check the parameters ##
|
||||
// ##
|
||||
//###########################################################################
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : internal_find_first
|
||||
/// @brief find if a value exist in the range [first, last).
|
||||
/// Always return as valid iterator in the range [first, last-1]
|
||||
/// If exist return the iterator to the first occurrence. If don't exist
|
||||
/// return the first greater than val.
|
||||
/// If val is greater than the *(last-1), return (last-1)
|
||||
/// If val is lower than (*first), return first
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found,
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t internal_find_first ( Iter_t first, Iter_t last,
|
||||
const value_iter<Iter_t> &val,
|
||||
const Compare & comp= Compare() )
|
||||
{
|
||||
Iter_t LI = first , LS = last - 1, it_out = first;
|
||||
while ( LI != LS)
|
||||
{ it_out = LI + ( (LS - LI) >> 1);
|
||||
if ( comp ( *it_out, val)) LI = it_out + 1 ; else LS = it_out ;
|
||||
}
|
||||
return LS ;
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : internal_find_last
|
||||
/// @brief find if a value exist in the range [first, last).
|
||||
/// Always return as valid iterator in the range [first, last-1]
|
||||
/// If exist return the iterator to the last occurrence.
|
||||
/// If don't exist return the first lower than val.
|
||||
/// If val is greater than *(last-1) return (last-1).
|
||||
/// If is lower than the first, return first
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found, if not found return last
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t internal_find_last ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
const Compare &comp= Compare() )
|
||||
{
|
||||
Iter_t LI = first , LS = last - 1, it_out = first ;
|
||||
while ( LI != LS)
|
||||
{ it_out = LI + ( (LS - LI + 1) >> 1);
|
||||
if ( comp (val, *it_out)) LS = it_out - 1 ; else LI = it_out ;
|
||||
}
|
||||
return LS ;
|
||||
}
|
||||
|
||||
//
|
||||
//###########################################################################
|
||||
// ##
|
||||
// ################################################################ ##
|
||||
// # # ##
|
||||
// # P U B L I C F U N C T I O N S # ##
|
||||
// # # ##
|
||||
// ################################################################ ##
|
||||
// ##
|
||||
//###########################################################################
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : find_first
|
||||
/// @brief find if a value exist in the range [first, last). If exist return the
|
||||
/// iterator to the first occurrence. If don't exist return last
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found, and if not last
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t find_first ( Iter_t first, Iter_t last,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare comp = Compare() )
|
||||
{
|
||||
assert ( (last - first) >= 0 );
|
||||
if ( first == last) return last ;
|
||||
Iter_t LS = internal_find_first ( first, last, val, comp);
|
||||
return (comp (*LS, val) or comp (val, *LS))?last:LS;
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : find_last
|
||||
/// @brief find if a value exist in the range [first, last). If exist return the
|
||||
/// iterator to the last occurrence. If don't exist return last
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found, if not found return last
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t find_last ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare comp = Compare())
|
||||
{
|
||||
assert ( (last - first ) >= 0 );
|
||||
if ( last == first ) return last ;
|
||||
Iter_t LS = internal_find_last (first, last, val, comp);
|
||||
return (comp (*LS, val) or comp (val, *LS))?last:LS ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// function : lower_bound
|
||||
/// @brief Returns an iterator pointing to the first element in the range
|
||||
/// [first, last) that is not less than (i.e. greater or equal to) val.
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t lower_bound ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare &comp = Compare() )
|
||||
{
|
||||
assert ( (last - first ) >= 0 );
|
||||
if ( last == first ) return last ;
|
||||
Iter_t itaux = internal_find_first( first, last, val,comp);
|
||||
return (itaux == (last - 1) and comp (*itaux, val))?last: itaux;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
// function :upper_bound
|
||||
/// @brief return the first element greather than val.If don't exist
|
||||
/// return last
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t upper_bound ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare &comp = Compare() )
|
||||
{
|
||||
assert ( (last - first ) >= 0 );
|
||||
if ( last == first ) return last ;
|
||||
Iter_t itaux = internal_find_last( first, last, val,comp);
|
||||
return ( itaux == first and comp (val,*itaux))? itaux: itaux + 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
// function :equal_range
|
||||
/// @brief return a pair of lower_bound and upper_bound with the value val.If
|
||||
/// don't exist return last in the two elements of the pair
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return pair of iterators
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline std::pair<Iter_t, Iter_t> equal_range ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare &comp = Compare() )
|
||||
{
|
||||
return std::make_pair(lower_bound(first, last, val,comp),
|
||||
upper_bound(first, last, val,comp));
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : insert_first
|
||||
/// @brief find if a value exist in the range [first, last). If exist return the
|
||||
/// iterator to the first occurrence. If don't exist return last
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found, and if not last
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t insert_first ( Iter_t first, Iter_t last,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare comp = Compare() )
|
||||
{
|
||||
return lower_bound (first, last, val, comp);
|
||||
}
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// function : insert_last
|
||||
/// @brief find if a value exist in the range [first, last). If exist return the
|
||||
/// iterator to the last occurrence. If don't exist return last
|
||||
//
|
||||
/// @param [in] first : iterator to the first element of the range
|
||||
/// @param [in] last : iterator to the last element of the range
|
||||
/// @param [in] val : value to find
|
||||
/// @param [in] comp : object for to compare two value_t objects
|
||||
/// @return iterator to the element found, if not found return last
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template < class Iter_t, class Compare = compare_iter<Iter_t> >
|
||||
inline Iter_t insert_last ( Iter_t first, Iter_t last ,
|
||||
const value_iter<Iter_t> &val,
|
||||
Compare comp = Compare())
|
||||
{
|
||||
return upper_bound (first, last, val, comp);
|
||||
}
|
||||
|
||||
*/
|
||||
//
|
||||
//****************************************************************************
|
||||
} // End namespace util
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#ifndef __BOOST_SORT_COMMON_UTIL_TRAITS_HPP
|
||||
#define __BOOST_SORT_COMMON_UTIL_TRAITS_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_STABLE_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_PARALLEL_STABLE_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <iterator>
|
||||
@@ -131,7 +130,7 @@ parallel_stable_sort <Iter_t, Compare>
|
||||
nelem = range_initial.size();
|
||||
size_t nptr = (nelem + 1) >> 1;
|
||||
|
||||
if (nelem < nelem_min or nthread < 2)
|
||||
if (nelem < nelem_min || nthread < 2)
|
||||
{
|
||||
bss::spinsort<Iter_t, Compare>
|
||||
(range_initial.first, range_initial.last, comp);
|
||||
@@ -141,13 +140,13 @@ parallel_stable_sort <Iter_t, Compare>
|
||||
//------------------- check if sort --------------------------------------
|
||||
bool sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sw = not comp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sw = ! comp(*it2, *it1)); it1 = it2++);
|
||||
if (sw) return;
|
||||
|
||||
//------------------- check if reverse sort ---------------------------
|
||||
sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
if (sw)
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_DETAIL_SAMPLE_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_DETAIL_SAMPLE_SORT_HPP
|
||||
|
||||
#include <ciso646>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <iterator>
|
||||
@@ -249,13 +248,13 @@ sample_sort<Iter_t, Compare>
|
||||
vfuture.resize(nthread);
|
||||
|
||||
// Adjust when have many threads and only a few elements
|
||||
while (nelem > thread_min and (nthread * nthread) > (nelem >> 3))
|
||||
while (nelem > thread_min && (nthread * nthread) > (nelem >> 3))
|
||||
{
|
||||
nthread /= 2;
|
||||
};
|
||||
ninterval = (nthread << 3);
|
||||
|
||||
if (nthread < 2 or nelem <= (thread_min))
|
||||
if (nthread < 2 || nelem <= (thread_min))
|
||||
{
|
||||
bss::spinsort<Iter_t, Compare>(first, last, comp);
|
||||
return;
|
||||
@@ -264,13 +263,13 @@ sample_sort<Iter_t, Compare>
|
||||
//------------------- check if sort --------------------------------------
|
||||
bool sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sw = not comp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sw = ! comp(*it2, *it1)); it1 = it2++);
|
||||
if (sw) return;
|
||||
|
||||
//------------------- check if reverse sort ---------------------------
|
||||
sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
if (sw)
|
||||
{
|
||||
using std::swap;
|
||||
@@ -307,7 +306,7 @@ sample_sort<Iter_t, Compare>
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
if (not error)
|
||||
if (! error)
|
||||
{
|
||||
first_merge();
|
||||
construct = true;
|
||||
@@ -334,7 +333,7 @@ void sample_sort<Iter_t, Compare>::destroy_all(void)
|
||||
destroy(global_buf);
|
||||
construct = false;
|
||||
}
|
||||
if (global_buf.first != nullptr and owner)
|
||||
if (global_buf.first != nullptr && owner)
|
||||
std::free(global_buf.first);
|
||||
}
|
||||
//
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#ifndef __BOOST_SORT_PARALLEL_ALGORITHM_SPIN_SORT_HPP
|
||||
#define __BOOST_SORT_PARALLEL_ALGORITHM_SPIN_SORT_HPP
|
||||
|
||||
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
@@ -183,7 +181,7 @@ static bool check_stable_sort(const range<Iter1_t> &rng_data,
|
||||
bool sw = true;
|
||||
Iter1_t it2 = rng_data.first + 1;
|
||||
for (Iter1_t it1 = rng_data.first;
|
||||
it2 != rng_data.last and (sw = not comp(*it2, *it1)); it1 =
|
||||
it2 != rng_data.last && (sw = ! comp(*it2, *it1)); it1 =
|
||||
it2++)
|
||||
;
|
||||
if (sw) return true;
|
||||
@@ -200,7 +198,7 @@ static bool check_stable_sort(const range<Iter1_t> &rng_data,
|
||||
if ((it2 != (rng_data.first + 1))) return false;
|
||||
sw = true;
|
||||
for (Iter1_t it1 = rng_data.first;
|
||||
it2 != rng_data.last and (sw = comp(*it2, *it1)); it1 =
|
||||
it2 != rng_data.last && (sw = comp(*it2, *it1)); it1 =
|
||||
it2++)
|
||||
;
|
||||
if (size_t(rng_data.last - it2) >= min_insert_partial_sort) return false;
|
||||
@@ -257,7 +255,7 @@ static void range_sort(const range<Iter1_t> &range1,
|
||||
//-----------------------------------------------------------------------
|
||||
typedef range<Iter1_t> range_it1;
|
||||
typedef range<Iter2_t> range_it2;
|
||||
assert(range1.size() == range2.size() and level != 0);
|
||||
assert(range1.size() == range2.size() && level != 0);
|
||||
|
||||
//------------------- check if sort --------------------------------------
|
||||
if (range1.size() > 1024)
|
||||
@@ -420,7 +418,7 @@ public:
|
||||
destroy(range<value_t *>(ptr, ptr + nptr));
|
||||
construct = false;
|
||||
};
|
||||
if (owner and ptr != nullptr) std::free (ptr);
|
||||
if (owner && ptr != nullptr) std::free (ptr);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -464,13 +462,13 @@ spinsort <Iter_t, Compare>
|
||||
//------------------- check if sort ---------------------------------
|
||||
bool sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1; it2 != last
|
||||
and (sw = not comp(*it2, *it1)); it1 = it2++) ;
|
||||
&& (sw = ! comp(*it2, *it1)); it1 = it2++) ;
|
||||
if (sw) return;
|
||||
|
||||
//------------------- check if reverse sort -------------------------
|
||||
sw = true;
|
||||
for (Iter_t it1 = first, it2 = first + 1;
|
||||
it2 != last and (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
it2 != last && (sw = comp(*it2, *it1)); it1 = it2++);
|
||||
if (sw)
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
#include <ciso646>
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/sort/sort.hpp>
|
||||
@@ -165,7 +164,7 @@ void test_int_array(uint32_t NELEM)
|
||||
|
||||
bsp::block_indirect_sort(V1.begin(), V1.end());
|
||||
for (unsigned i = 1; i < NELEM; i++)
|
||||
{ BOOST_CHECK(not (V1[i] < V1[i-1]));
|
||||
{ BOOST_CHECK (! (V1[i] < V1[i-1]));
|
||||
};
|
||||
};
|
||||
void test3 (void)
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <ciso646>
|
||||
#include <boost/sort/flat_stable_sort/flat_stable_sort.hpp>
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
@@ -61,7 +60,7 @@ void test1 ( )
|
||||
|
||||
BOOST_CHECK (V1.size ( ) == V2.size ( ));
|
||||
for (uint32_t i = 0; i < V1.size ( ); ++i) {
|
||||
BOOST_CHECK (V1[ i ].num == V2[ i ].num and
|
||||
BOOST_CHECK (V1[ i ].num == V2[ i ].num &&
|
||||
V1[ i ].tail == V2[ i ].tail);
|
||||
};
|
||||
};
|
||||
@@ -130,7 +129,7 @@ void test3 (void)
|
||||
};
|
||||
flat_stable_sort( V.begin() , V.end(), compare_t());
|
||||
for ( uint32_t i =0 ; i < ( NELEM * 10); ++i)
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) and V[i].tail == (i %10) );
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) && V[i].tail == (i %10) );
|
||||
};
|
||||
}
|
||||
int test_main (int, char *[])
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
///
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <ciso646>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -99,7 +98,7 @@ void test02 (void)
|
||||
{
|
||||
BOOST_CHECK ((*(it - 1)) <= (*it));
|
||||
};
|
||||
BOOST_CHECK (A[ 998 ] == 0 and A[ 999 ] == 0 and A[ 1000 + NELEM ] == 0 and
|
||||
BOOST_CHECK (A[ 998 ] == 0 && A[ 999 ] == 0 && A[ 1000 + NELEM ] == 0 &&
|
||||
A[ 1001 + NELEM ] == 0);
|
||||
|
||||
|
||||
@@ -115,8 +114,8 @@ void test02 (void)
|
||||
{
|
||||
BOOST_CHECK ((*(it - 1)) <= (*it));
|
||||
};
|
||||
BOOST_CHECK (A[ 998 ] == 999999999 and A[ 999 ] == 999999999 and
|
||||
A[ 1000 + NELEM ] == 999999999 and
|
||||
BOOST_CHECK (A[ 998 ] == 999999999 && A[ 999 ] == 999999999 &&
|
||||
A[ 1000 + NELEM ] == 999999999 &&
|
||||
A[ 1001 + NELEM ] == 999999999);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
///
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <ciso646>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
@@ -61,12 +61,12 @@ void test1()
|
||||
|
||||
BOOST_CHECK(V1.size() == V2.size());
|
||||
for (uint32_t i = 0; i < V1.size(); ++i)
|
||||
{ BOOST_CHECK(V1[i].num == V2[i].num and V1[i].tail == V2[i].tail);
|
||||
{ BOOST_CHECK(V1[i].num == V2[i].num && V1[i].tail == V2[i].tail);
|
||||
};
|
||||
|
||||
BOOST_CHECK(V3.size() == V2.size());
|
||||
for (uint32_t i = 0; i < V3.size(); ++i)
|
||||
{ BOOST_CHECK(V3[i].num == V2[i].num and V3[i].tail == V2[i].tail);
|
||||
{ BOOST_CHECK(V3[i].num == V2[i].num && V3[i].tail == V2[i].tail);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -170,7 +170,7 @@ void test5 (void)
|
||||
};
|
||||
bss::parallel_stable_sort( V.begin() , V.end());
|
||||
for ( uint32_t i =0 ; i < ( NELEM * 10); ++i)
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) and V[i].tail == (i %10) );
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) && V[i].tail == (i %10) );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
///
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <ciso646>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
@@ -59,12 +58,12 @@ void test1()
|
||||
|
||||
BOOST_CHECK(V1.size() == V2.size());
|
||||
for (uint32_t i = 0; i < V1.size(); ++i)
|
||||
{ BOOST_CHECK(V1[i].num == V2[i].num and V1[i].tail == V2[i].tail);
|
||||
{ BOOST_CHECK(V1[i].num == V2[i].num && V1[i].tail == V2[i].tail);
|
||||
};
|
||||
|
||||
BOOST_CHECK(V3.size() == V2.size());
|
||||
for (uint32_t i = 0; i < V3.size(); ++i)
|
||||
{ BOOST_CHECK(V3[i].num == V2[i].num and V3[i].tail == V2[i].tail);
|
||||
{ BOOST_CHECK(V3[i].num == V2[i].num && V3[i].tail == V2[i].tail);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -168,7 +167,7 @@ void test5 (void)
|
||||
};
|
||||
bss::sample_sort( V.begin() , V.end());
|
||||
for ( uint32_t i =0 ; i < ( NELEM * 10); ++i)
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) and V[i].tail == (i %10) );
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) && V[i].tail == (i %10) );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
///
|
||||
/// @remarks
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <ciso646>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
@@ -70,7 +69,7 @@ void test1 ( )
|
||||
|
||||
BOOST_CHECK (V1.size ( ) == V2.size ( ));
|
||||
for (uint32_t i = 0; i < V1.size ( ); ++i) {
|
||||
BOOST_CHECK (V1[ i ].num == V2[ i ].num and
|
||||
BOOST_CHECK (V1[ i ].num == V2[ i ].num &&
|
||||
V1[ i ].tail == V2[ i ].tail);
|
||||
};
|
||||
};
|
||||
@@ -171,7 +170,7 @@ void test4 (void)
|
||||
};
|
||||
spinsort( V.begin() , V.end(), compare_t());
|
||||
for ( uint32_t i =0 ; i < ( NELEM * 10); ++i)
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) and V[i].tail == (i %10) );
|
||||
{ BOOST_CHECK ( V[i].num == (i / 10) && V[i].tail == (i %10) );
|
||||
};
|
||||
}
|
||||
int test_main (int, char *[])
|
||||
|
||||
Reference in New Issue
Block a user