Skip to content

Commit

Permalink
[cpplint] Fix C-style cast linting errors from cpplint 1.5.5 (#8106)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandron authored May 21, 2021
1 parent d8fd5bd commit c30fbf1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/tvm/topi/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ inline Tensor gather(const Tensor& data, int axis, const Tensor& indices,
}
Array<PrimExpr> real_indices;
for (size_t i = 0; i < ndim_i; ++i) {
if (i == (size_t)axis) {
if (i == static_cast<size_t>(axis)) {
real_indices.push_back(indices(indices_position));
} else {
real_indices.push_back(indices_position[i]);
Expand Down
2 changes: 1 addition & 1 deletion src/relay/analysis/context_analysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DeviceDomain {
struct Hash {
size_t operator()(const DeviceDomainPtr& domain) const {
if (domain->IsEmptyDomain()) {
return (size_t)(domain.get());
return static_cast<size_t>(reinterpret_cast<uintptr_t>(domain.get()));
} else {
size_t const h1(std::hash<int>()(static_cast<int>(domain->device_.device_type)));
size_t const h2(std::hash<int>()(domain->device_.device_id));
Expand Down
2 changes: 1 addition & 1 deletion src/relay/op/tensor/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3278,7 +3278,7 @@ bool GatherRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
std::vector<IndexExpr> oshape;
oshape.reserve(ndim_data);
for (size_t i = 0; i < ndim_data; ++i) {
if (i == (size_t)axis) {
if (i == static_cast<size_t>(axis)) {
const int64_t* indice_shape_i = tir::as_const_int(indices->shape[i]);
ICHECK_GE(*indice_shape_i, 1);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/crt/utvm_rpc_common/write_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ tvm_crt_error_t WriteStream::WriteAll(uint8_t* data, size_t data_size_bytes,
return kTvmErrorWriteStreamShortWrite;
} else if (to_return < 0) {
return (tvm_crt_error_t)to_return;
} else if (to_return > 0 && ((size_t)to_return) > data_size_bytes) {
} else if (to_return > 0 && (static_cast<size_t>(to_return)) > data_size_bytes) {
return kTvmErrorWriteStreamLongWrite;
}

Expand Down

0 comments on commit c30fbf1

Please sign in to comment.