mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Change Raw_Map.len to int from uintptr
This commit is contained in:
@@ -416,7 +416,7 @@ Raw_Map :: struct {
|
|||||||
// Map_Hash directly, though for consistency sake it's written as if it were
|
// Map_Hash directly, though for consistency sake it's written as if it were
|
||||||
// an array of Map_Cell(Map_Hash).
|
// an array of Map_Cell(Map_Hash).
|
||||||
data: uintptr, // 8-bytes on 64-bits, 4-bytes on 32-bits
|
data: uintptr, // 8-bytes on 64-bits, 4-bytes on 32-bits
|
||||||
len: uintptr, // 8-bytes on 64-bits, 4-bytes on 32-bits
|
len: int, // 8-bytes on 64-bits, 4-bytes on 32-bits
|
||||||
allocator: Allocator, // 16-bytes on 64-bits, 8-bytes on 32-bits
|
allocator: Allocator, // 16-bytes on 64-bits, 8-bytes on 32-bits
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ map_cell_index_dynamic_const :: proc "contextless" (base: uintptr, #no_alias inf
|
|||||||
|
|
||||||
// len() for map
|
// len() for map
|
||||||
map_len :: #force_inline proc "contextless" (m: Raw_Map) -> int {
|
map_len :: #force_inline proc "contextless" (m: Raw_Map) -> int {
|
||||||
return int(m.len)
|
return m.len
|
||||||
}
|
}
|
||||||
|
|
||||||
// cap() for map
|
// cap() for map
|
||||||
@@ -591,7 +591,7 @@ map_shrink_dynamic :: proc(#no_alias m: ^Raw_Map, #no_alias info: ^Map_Info) ->
|
|||||||
// one minus the current log2 capacity's resize threshold. That is the shrunk
|
// one minus the current log2 capacity's resize threshold. That is the shrunk
|
||||||
// map needs to be within the max load factor.
|
// map needs to be within the max load factor.
|
||||||
log2_capacity := map_log2_cap(m^)
|
log2_capacity := map_log2_cap(m^)
|
||||||
if m.len >= map_load_factor(log2_capacity - 1) {
|
if uintptr(m.len) >= map_load_factor(log2_capacity - 1) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user