Minimize unneeded casts

This commit is contained in:
gingerBill
2021-03-03 14:31:17 +00:00
parent 75f127af7c
commit b727b6438b
24 changed files with 108 additions and 109 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ is_integer_negative :: proc(x: u64, is_signed: bool, bit_size: int) -> (u: u64,
case 64:
i := i64(u);
neg = i < 0;
u = u64(abs(i64(i)));
u = u64(abs(i));
case:
panic("is_integer_negative: Unknown integer size");
}
@@ -105,7 +105,7 @@ is_integer_negative_128 :: proc(x: u128, is_signed: bool, bit_size: int) -> (u:
case 128:
i := i128(u);
neg = i < 0;
u = u128(abs(i128(i)));
u = u128(abs(i));
case:
panic("is_integer_negative: Unknown integer size");
}
+2 -2
View File
@@ -231,7 +231,7 @@ parse_u64_maybe_prefixed :: proc(str: string) -> (value: u64, ok: bool) {
break;
}
value *= base;
value += u64(v);
value += v;
i += 1;
}
s = s[i:];
@@ -433,7 +433,7 @@ append_bool :: proc(buf: []byte, b: bool) -> string {
}
append_uint :: proc(buf: []byte, u: u64, base: int) -> string {
return append_bits(buf, u64(u), base, false, 8*size_of(uint), digits, nil);
return append_bits(buf, u, base, false, 8*size_of(uint), digits, nil);
}
append_int :: proc(buf: []byte, i: i64, base: int) -> string {
return append_bits(buf, u64(i), base, true, 8*size_of(int), digits, nil);