Begin work on separating int and word sizes (i.e. size_of(int) might not equal size_of(uintptr))

This commit is contained in:
gingerBill
2023-04-20 11:46:23 +01:00
parent b2b88f1d99
commit 84f966cb8f
5 changed files with 81 additions and 61 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ Raw_Map :: struct {
// Map_Hash directly, though for consistency sake it's written as if it were
// an array of Map_Cell(Map_Hash).
data: uintptr, // 8-bytes on 64-bits, 4-bytes on 32-bits
len: int, // 8-bytes on 64-bits, 4-bytes on 32-bits
len: uintptr, // 8-bytes on 64-bits, 4-bytes on 32-bits
allocator: Allocator, // 16-bytes on 64-bits, 8-bytes on 32-bits
}
+3 -3
View File
@@ -184,7 +184,7 @@ map_cell_index_static :: #force_inline proc "contextless" (cells: [^]Map_Cell($T
// len() for map
@(require_results)
map_len :: #force_inline proc "contextless" (m: Raw_Map) -> int {
return m.len
return int(m.len)
}
// cap() for map
@@ -207,8 +207,8 @@ map_load_factor :: #force_inline proc "contextless" (log2_capacity: uintptr) ->
}
@(require_results)
map_resize_threshold :: #force_inline proc "contextless" (m: Raw_Map) -> int {
return int(map_load_factor(map_log2_cap(m)))
map_resize_threshold :: #force_inline proc "contextless" (m: Raw_Map) -> uintptr {
return map_load_factor(map_log2_cap(m))
}
// The data stores the log2 capacity in the lower six bits. This is primarily