tqchen commented on code in PR #78:
URL: https://github.com/apache/tvm-ffi/pull/78#discussion_r2408973770
##########
include/tvm/ffi/string.h:
##########
@@ -924,11 +931,11 @@ struct TypeTraits<std::string>
return std::string(src->data, src->size);
}
- TVM_FFI_INLINE static std::string ConvertFallbackValue(Bytes src) {
+ TVM_FFI_INLINE static std::string ConvertFallbackValue(const Bytes& src) {
Review Comment:
convert fallback value is better handled pass by value, because the value is
already being generated, and pass by value may enable possible followup
opportunities of move
##########
src/ffi/extra/structural_equal.cc:
##########
@@ -317,30 +319,34 @@ class StructEqualHandler {
if (lhs.size() == rhs.size()) return true;
if (mismatch_lhs_reverse_path_ != nullptr) {
if (lhs.size() > rhs.size()) {
-
mismatch_lhs_reverse_path_->emplace_back(reflection::AccessStep::ArrayItem(rhs.size()));
+ mismatch_lhs_reverse_path_->emplace_back(
+
reflection::AccessStep::ArrayItem(static_cast<int64_t>(rhs.size())));
mismatch_rhs_reverse_path_->emplace_back(
- reflection::AccessStep::ArrayItemMissing(rhs.size()));
+
reflection::AccessStep::ArrayItemMissing(static_cast<int64_t>(rhs.size())));
} else {
mismatch_lhs_reverse_path_->emplace_back(
- reflection::AccessStep::ArrayItemMissing(lhs.size()));
-
mismatch_rhs_reverse_path_->emplace_back(reflection::AccessStep::ArrayItem(lhs.size()));
+
reflection::AccessStep::ArrayItemMissing(static_cast<int64_t>(lhs.size())));
+ mismatch_rhs_reverse_path_->emplace_back(
+
reflection::AccessStep::ArrayItem(static_cast<int64_t>(lhs.size())));
}
}
return false;
}
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
bool CompareShape(Shape lhs, Shape rhs) {
if (lhs.size() != rhs.size()) {
return false;
}
- for (size_t i = 0; i < lhs.size(); ++i) {
+ for (int64_t i = 0, n = static_cast<int64_t>(lhs.size()); i < n; ++i) {
Review Comment:
size_t is fine? this one is a bit strange here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]