mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 11:20:08 +00:00
Make source code compile with 32 bit (but not build 32 bit code)
This commit is contained in:
+1
-1
@@ -235,7 +235,7 @@ pool_alloc :: proc(using pool: ^Pool, bytes: int) -> rawptr {
|
||||
}
|
||||
|
||||
memory := current_pos;
|
||||
current_pos = ptr_offset((^byte)(current_pos), uintptr(bytes));
|
||||
current_pos = ptr_offset((^byte)(current_pos), bytes);
|
||||
bytes_left -= bytes;
|
||||
return memory;
|
||||
}
|
||||
|
||||
+5
-5
@@ -62,16 +62,16 @@ compare :: proc "contextless" (a, b: []byte) -> int {
|
||||
}
|
||||
compare_byte_ptrs :: proc "contextless" (a, b: ^byte, n: int) -> int {
|
||||
pa :: ptr_offset;
|
||||
for i in 0..uintptr(n) do switch {
|
||||
for i in 0..n do switch {
|
||||
case pa(a, i)^ < pa(b, i)^: return -1;
|
||||
case pa(a, i)^ > pa(b, i)^: return +1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr_offset :: proc "contextless" (ptr: $P/^$T, n: uintptr) -> P {
|
||||
new := uintptr(ptr) + size_of(T)*n;
|
||||
return P(new);
|
||||
ptr_offset :: proc "contextless" (ptr: $P/^$T, n: int) -> P {
|
||||
new := int(uintptr(ptr)) + size_of(T)*n;
|
||||
return P(uintptr(new));
|
||||
}
|
||||
|
||||
ptr_sub :: proc "contextless" (a, b: $P/^$T) -> int {
|
||||
@@ -143,7 +143,7 @@ allocation_header_fill :: proc(header: ^AllocationHeader, data: rawptr, size: in
|
||||
ptr := cast(^uint)(ptr_offset(header, 1));
|
||||
n := ptr_sub(cast(^uint)data, ptr);
|
||||
|
||||
for i in 0..uintptr(n) {
|
||||
for i in 0..n {
|
||||
ptr_offset(ptr, i)^ = ~uint(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user