Files
rocm-systems/rocclr/platform/ndrange.cpp
T
Laurent Morichetti 20c7173849 Merge branch 'origin/pghafari/vdi-prototype' into lmoriche/amd-master
Change-Id: Id3b833d405596735becb3346f3b08c6da57033fe
2020-01-30 20:12:13 -08:00

53 baris
1.1 KiB
C++

//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#include "platform/ndrange.hpp"
namespace amd {
NDRange::NDRange(size_t dimensions) : dimensions_(dimensions) { *this = 0; }
NDRange::NDRange(const NDRange& space) : dimensions_(space.dimensions_) { *this = space; }
NDRange& NDRange::operator=(size_t x) {
for (size_t i = 0; i < dimensions_; ++i) {
data_[i] = x;
}
return *this;
}
NDRange::~NDRange() {}
bool NDRange::operator==(const NDRange& x) const {
assert(dimensions_ == x.dimensions_ && "dimensions mismatch");
for (size_t i = 0; i < dimensions_; ++i) {
if (data_[i] != x.data_[i]) {
return false;
}
}
return true;
}
bool NDRange::operator==(size_t x) const {
for (size_t i = 0; i < dimensions_; ++i) {
if (data_[i] != x) {
return false;
}
}
return true;
}
#ifdef DEBUG
void NDRange::printOn(FILE* file) const {
fprintf(file, "[");
for (size_t i = dimensions_ - 1; i > 0; --i) {
fprintf(file, SIZE_T_FMT ", ", data_[i]);
}
fprintf(file, SIZE_T_FMT "]", data_[0]);
}
#endif // DEBUG
} // namespace amd