mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Use __type_info_of internally
This commit is contained in:
+10
-1
@@ -244,9 +244,18 @@ __typeid_of :: proc "contextless" (ti: ^Type_Info) -> typeid {
|
||||
start := uintptr(&__type_table[0]);
|
||||
end := uintptr(ti);
|
||||
id := (end-start)/size_of(Type_Info);
|
||||
if uintptr(len(__type_table)) < id {
|
||||
return nil;
|
||||
}
|
||||
return transmute(typeid)id;
|
||||
}
|
||||
|
||||
__type_info_of :: proc "contextless" (id: typeid) -> ^Type_Info {
|
||||
n := int(transmute(uintptr)id);
|
||||
if n < 0 || n >= len(__type_table) {
|
||||
n = 0;
|
||||
}
|
||||
return &__type_table[n];
|
||||
}
|
||||
|
||||
typeid_base :: proc "contextless" (id: typeid) -> typeid {
|
||||
ti := type_info_of(id);
|
||||
|
||||
Reference in New Issue
Block a user