MCPcopy Create free account
hub / github.com/apache/tvm-ffi / Object_IsInstance

Function Object_IsInstance

examples/abi_overview/example_code.c:135–148  ·  view source on GitHub ↗

[Object.IsInstance.begin]

Source from the content-addressed store, hash-verified

133
134// [Object.IsInstance.begin]
135int Object_IsInstance(int32_t sub_type_index, int32_t super_type_index, int32_t super_type_depth) {
136 const TVMFFITypeInfo* sub_type_info = NULL;
137 // Everything is a subclass of object.
138 if (sub_type_index == super_type_index) {
139 return 1;
140 }
141 // Invariance: parent index is always smaller than the child.
142 if (sub_type_index < super_type_index) {
143 return 0;
144 }
145 sub_type_info = TVMFFIGetTypeInfo(sub_type_index);
146 return sub_type_info->type_depth > super_type_depth &&
147 sub_type_info->type_ancestors[super_type_depth]->type_index == super_type_index;
148}
149// [Object.IsInstance.end]
150
151// [Object.MoveFromAny.begin]

Callers

nothing calls this directly

Calls 1

TVMFFIGetTypeInfoFunction · 0.85

Tested by

no test coverage detected