diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-09 22:58:44 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-09 22:58:44 +0000 |
| commit | e5c39fb2a98d878b0cf5ca6fcea3a776527628a1 (patch) | |
| tree | 9917f1557b9671e03726499ba550b3358d04b839 /core/_preload.odin | |
| parent | eb4b3f5976d1563cd97841964e829fc638179cc5 (diff) | |
Fix opening file without close; Minor fixes
Diffstat (limited to 'core/_preload.odin')
| -rw-r--r-- | core/_preload.odin | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/core/_preload.odin b/core/_preload.odin index 4a324f90c..87c28c59e 100644 --- a/core/_preload.odin +++ b/core/_preload.odin @@ -207,7 +207,7 @@ __Map_Header :: struct #ordered { is_key_string: bool, entry_size: int, entry_align: int, - value_offset: int, + value_offset: uintptr, value_size: int, } @@ -217,8 +217,11 @@ type_info_base :: proc(info: ^Type_Info) -> ^Type_Info { if info == nil do return nil; base := info; - switch i in base.variant { - case Type_Info_Named: base = i.base; + loop: for { + switch i in base.variant { + case Type_Info_Named: base = i.base; + case: break loop; + } } return base; } @@ -228,9 +231,12 @@ type_info_base_without_enum :: proc(info: ^Type_Info) -> ^Type_Info { if info == nil do return nil; base := info; - switch i in base.variant { - case Type_Info_Named: base = i.base; - case Type_Info_Enum: base = i.base; + loop: for { + switch i in base.variant { + case Type_Info_Named: base = i.base; + case Type_Info_Enum: base = i.base; + case: break loop; + } } return base; } @@ -877,24 +883,6 @@ __dynamic_array_append_nothing :: proc(array_: rawptr, elem_size, elem_align: in return array.len; } -__slice_append :: proc(slice_: rawptr, elem_size, elem_align: int, - items: rawptr, item_count: int) -> int { - slice := cast(^raw.Slice)slice_; - - if item_count <= 0 || items == nil { - return slice.len; - } - - item_count = min(slice.cap-slice.len, item_count); - if item_count > 0 { - data := cast(^u8)slice.data; - assert(data != nil); - __mem_copy(data + (elem_size*slice.len), items, elem_size * item_count); - slice.len += item_count; - } - return slice.len; -} - // Map stuff __default_hash :: proc(data: []u8) -> u128 { |