tqchen commented on code in PR #370:
URL: https://github.com/apache/tvm-ffi/pull/370#discussion_r2670169954


##########
src/ffi/extra/structural_hash.cc:
##########
@@ -311,9 +312,14 @@ uint64_t StructuralHash::Hash(const Any& value, bool 
map_free_vars, bool skip_te
   return handler.HashAny(value);
 }
 
+static int64_t FFIStructuralHash(const Any& value, bool map_free_vars, bool 
skip_tensor_content) {

Review Comment:
   add comment on why here, we explicitly bitcast(static cast effectively does 
bit cast) to int64 so returned value bypasses the signed check
   



##########
src/ffi/extra/structural_hash.cc:
##########
@@ -150,15 +150,16 @@ class StructuralHashHandler {
                 std::swap(allow_free_var, map_free_vars_);
                 uint64_t hash_value = HashAny(val);
                 std::swap(allow_free_var, map_free_vars_);
-                return details::StableHashCombine(init_hash, hash_value);
+                return 
static_cast<int64_t>(details::StableHashCombine(init_hash, hash_value));

Review Comment:
   comment, we explicitly bitcast to i64 so return value bypasses the bound 
check



-- 
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]

Reply via email to