Skip to content

Commit

Permalink
Fixed errors and warnings given by VS2010
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemidov committed Apr 2, 2014
1 parent e3b83bd commit e079169
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion examples/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ void benchmark_scan(
if (options.bm_cpu) {
prof.tic_cpu("CPU");
for(size_t i = 0; i < M; i++) {
key_type sum = 0.0;
key_type sum = key_type();
for(size_t j = 0; j < N; ++j) {
key_type next = sum + x0[j];
x1[j] = sum;
Expand Down
8 changes: 4 additions & 4 deletions tests/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_default)
vex::vector<int > keys(ctx, k);
vex::vector<float> vals(ctx, v);

std::iota(p.begin(), p.end(), 0);
for(size_t i = 0; i < p.size(); ++i) p[i] = static_cast<int>(i);
std::stable_sort(p.begin(), p.end(), [&](int i, int j) { return k[i] < k[j]; });

vex::sort_by_key(keys, vals);
Expand All @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_custom_op)
vex::vector<int > keys(ctx, k);
vex::vector<float> vals(ctx, v);

std::iota(p.begin(), p.end(), 0);
for(size_t i = 0; i < p.size(); ++i) p[i] = static_cast<int>(i);

struct even_first_t {
typedef bool result_type;
Expand All @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_custom_op)
)
} even_first;

std::stable_sort(p.begin(), p.end(), [&](int i, int j) {
std::stable_sort(p.begin(), p.end(), [&](int i, int j) -> bool {
int a = k[i];
int b = k[j];
return even_first(a, b);
Expand Down Expand Up @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_tuple)
vex::vector<short> vals2(ctx, v2);

std::vector<int> p(n);
std::iota(p.begin(), p.end(), 0);
for(size_t i = 0; i < p.size(); ++i) p[i] = static_cast<int>(i);

struct less_t {
typedef bool result_type;
Expand Down
10 changes: 5 additions & 5 deletions vexcl/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class recorder {

// Reset preamble and state.
preamble.reset(new backend::source_generator);
state = detail::empty_state();
state = vex::detail::empty_state();
}

static std::ostream& get() {
Expand All @@ -91,7 +91,7 @@ class recorder {
return *preamble;
}

static detail::kernel_generator_state_ptr get_state() {
static vex::detail::kernel_generator_state_ptr get_state() {
return state;
}

Expand All @@ -102,7 +102,7 @@ class recorder {
static size_t index;
static std::ostream *os;
static std::unique_ptr<backend::source_generator> preamble;
static detail::kernel_generator_state_ptr state;
static vex::detail::kernel_generator_state_ptr state;
};

template <bool dummy>
Expand All @@ -115,7 +115,7 @@ template <bool dummy>
std::unique_ptr<backend::source_generator> recorder<dummy>::preamble;

template <bool dummy>
detail::kernel_generator_state_ptr recorder<dummy>::state;
vex::detail::kernel_generator_state_ptr recorder<dummy>::state;

inline size_t var_id() {
return recorder<>::var_id();
Expand All @@ -129,7 +129,7 @@ inline backend::source_generator& get_preamble() {
return recorder<>::get_preamble();
}

inline detail::kernel_generator_state_ptr get_state() {
inline vex::detail::kernel_generator_state_ptr get_state() {
return recorder<>::get_state();
}
/// \endcond
Expand Down
14 changes: 7 additions & 7 deletions vexcl/scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,18 @@ void inclusive_scan(

auto &queue = input.queue_list();

for(size_t d = 0; d < queue.size(); ++d)
for(unsigned d = 0; d < queue.size(); ++d)
detail::scan(queue[d], input(d), output(d), init, false, oper.device);

std::vector<T> tail(queue.size() - 1);

for(size_t d = 1; d < queue.size(); ++d)
for(unsigned d = 1; d < queue.size(); ++d)
if (size_t head = output.part_start(d))
tail[d - 1] = output[head - 1];

std::partial_sum(tail.begin(), tail.end(), tail.begin(), oper);

for(size_t d = 1; d < queue.size(); ++d)
for(unsigned d = 1; d < queue.size(); ++d)
if (output.part_start(d)) {
vector<T> part(queue[d], output(d));
part = oper.device(part, tail[d - 1]);
Expand Down Expand Up @@ -492,20 +492,20 @@ void exclusive_scan(

std::vector<T> tail(queue.size() - 1);

for(size_t d = 1; d < queue.size(); ++d)
for(unsigned d = 1; d < queue.size(); ++d)
if (size_t head = input.part_start(d))
tail[d - 1] = input[head - 1];

for(size_t d = 0; d < queue.size(); ++d)
for(unsigned d = 0; d < queue.size(); ++d)
detail::scan(queue[d], input(d), output(d), init, true, oper.device);

for(size_t d = 1; d < queue.size(); ++d)
for(unsigned d = 1; d < queue.size(); ++d)
if (size_t head = output.part_start(d))
tail[d - 1] = oper(tail[d - 1], output[head - 1]);

std::partial_sum(tail.begin(), tail.end(), tail.begin(), oper);

for(size_t d = 1; d < queue.size(); ++d)
for(unsigned d = 1; d < queue.size(); ++d)
if (output.part_start(d)) {
vector<T> part(queue[d], output(d));
part = oper.device(part, tail[d - 1]);
Expand Down

0 comments on commit e079169

Please sign in to comment.