diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-03 14:31:17 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-03 14:31:17 +0000 |
| commit | b727b6438b86ccd2d60a8f18d8a8d990206613d8 (patch) | |
| tree | 5078b027d48f0fe5c5b5a9efe5be1b8bb68611ff /core/runtime | |
| parent | 75f127af7c635c0963e9c2ce5857be9b282ac435 (diff) | |
Minimize unneeded casts
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/default_allocators.odin | 2 | ||||
| -rw-r--r-- | core/runtime/dynamic_map_internal.odin | 12 | ||||
| -rw-r--r-- | core/runtime/error_checks.odin | 8 | ||||
| -rw-r--r-- | core/runtime/internal.odin | 4 | ||||
| -rw-r--r-- | core/runtime/internal_windows.odin | 10 |
5 files changed, 18 insertions, 18 deletions
diff --git a/core/runtime/default_allocators.odin b/core/runtime/default_allocators.odin index 518cdf287..03bc454d0 100644 --- a/core/runtime/default_allocators.odin +++ b/core/runtime/default_allocators.odin @@ -127,7 +127,7 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode old_ptr := uintptr(old_memory); if s.prev_allocation == old_memory { - s.curr_offset = int(uintptr(s.prev_allocation) - uintptr(start)); + s.curr_offset = int(uintptr(s.prev_allocation) - start); s.prev_allocation = nil; return nil; } diff --git a/core/runtime/dynamic_map_internal.odin b/core/runtime/dynamic_map_internal.odin index 824d2ce61..674df24d7 100644 --- a/core/runtime/dynamic_map_internal.odin +++ b/core/runtime/dynamic_map_internal.odin @@ -159,14 +159,14 @@ __get_map_header :: proc "contextless" (m: ^$T/map[$K]$V) -> Map_Header { header.equal = intrinsics.type_equal_proc(K); - header.entry_size = int(size_of(Entry)); - header.entry_align = int(align_of(Entry)); + header.entry_size = size_of(Entry); + header.entry_align = align_of(Entry); - header.key_offset = uintptr(offset_of(Entry, key)); - header.key_size = int(size_of(K)); + header.key_offset = offset_of(Entry, key); + header.key_size = size_of(K); - header.value_offset = uintptr(offset_of(Entry, value)); - header.value_size = int(size_of(V)); + header.value_offset = offset_of(Entry, value); + header.value_size = size_of(V); return header; } diff --git a/core/runtime/error_checks.odin b/core/runtime/error_checks.odin index a0a15590f..8874cce00 100644 --- a/core/runtime/error_checks.odin +++ b/core/runtime/error_checks.odin @@ -203,17 +203,17 @@ make_map_expr_error_loc :: #force_inline proc "contextless" (loc := #caller_loca bounds_check_error_loc :: #force_inline proc "contextless" (using loc := #caller_location, index, count: int) { - bounds_check_error(file_path, int(line), int(column), index, count); + bounds_check_error(file_path, line, column, index, count); } slice_expr_error_hi_loc :: #force_inline proc "contextless" (using loc := #caller_location, hi: int, len: int) { - slice_expr_error_hi(file_path, int(line), int(column), hi, len); + slice_expr_error_hi(file_path, line, column, hi, len); } slice_expr_error_lo_hi_loc :: #force_inline proc "contextless" (using loc := #caller_location, lo, hi: int, len: int) { - slice_expr_error_lo_hi(file_path, int(line), int(column), lo, hi, len); + slice_expr_error_lo_hi(file_path, line, column, lo, hi, len); } dynamic_array_expr_error_loc :: #force_inline proc "contextless" (using loc := #caller_location, low, high, max: int) { - dynamic_array_expr_error(file_path, int(line), int(column), low, high, max); + dynamic_array_expr_error(file_path, line, column, low, high, max); } diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 46e0ca92b..d04c6997b 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -195,7 +195,7 @@ memory_compare :: proc "contextless" (a, b: rawptr, n: int) -> int #no_bounds_ch n := uintptr(n); SU :: size_of(uintptr); - fast := uintptr(n/SU + 1); + fast := n/SU + 1; offset := (fast-1)*SU; curr_block := uintptr(0); if n < SU { @@ -232,7 +232,7 @@ memory_compare_zero :: proc "contextless" (a: rawptr, n: int) -> int #no_bounds_ n := uintptr(n); SU :: size_of(uintptr); - fast := uintptr(n/SU + 1); + fast := n/SU + 1; offset := (fast-1)*SU; curr_block := uintptr(0); if n < SU { diff --git a/core/runtime/internal_windows.odin b/core/runtime/internal_windows.odin index 10d2e2249..8bd3106bb 100644 --- a/core/runtime/internal_windows.odin +++ b/core/runtime/internal_windows.odin @@ -63,8 +63,8 @@ fixdfti :: proc(a: u64) -> i128 { aRep := a; aAbs := aRep & absMask; sign := i128(-1 if aRep & signBit != 0 else 1); - exponent := u64((aAbs >> significandBits) - exponentBias); - significand := u64((aAbs & significandMask) | implicitBit); + exponent := (aAbs >> significandBits) - exponentBias; + significand := (aAbs & significandMask) | implicitBit; // If exponent is negative, the result is zero. if exponent < 0 { @@ -103,7 +103,7 @@ floattidf :: proc(a: i128) -> f64 { s := a >> (N-1); a = (a ~ s) - s; sd: = N - _clz_i128(a); // number of significant digits - e := u32(sd - 1); // exponent + e := u32(sd - 1); // exponent if sd > DBL_MANT_DIG { switch sd { case DBL_MANT_DIG + 1: @@ -115,8 +115,8 @@ floattidf :: proc(a: i128) -> f64 { i128(u128(a) & (~u128(0) >> u128(N + DBL_MANT_DIG+2 - sd)) != 0); }; - a |= i128((a & 4) != 0); - a += 1; + a |= i128((a & 4) != 0); + a += 1; a >>= 2; if a & (1 << DBL_MANT_DIG) != 0 { |