mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-05 04:27:51 +00:00
Add sanity casts for 32/64 bit correctness
This commit is contained in:
@@ -341,7 +341,7 @@ bool sub_overflow_u64(u64 x, u64 y, u64 *result) {
|
||||
}
|
||||
|
||||
void mul_overflow_u64(u64 x, u64 y, u64 *lo, u64 *hi) {
|
||||
#if defined(GB_COMPILER_MSVC)
|
||||
#if defined(GB_COMPILER_MSVC) && defined(GB_ARCH_64_BIT)
|
||||
*lo = _umul128(x, y, hi);
|
||||
#else
|
||||
// URL(bill): https://stackoverflow.com/questions/25095741/how-can-i-multiply-64-bit-operands-and-get-128-bit-result-portably#25096197
|
||||
@@ -697,9 +697,9 @@ isize next_pow2_isize(isize n) {
|
||||
n |= n >> 4;
|
||||
n |= n >> 8;
|
||||
n |= n >> 16;
|
||||
if (gb_size_of(isize) == 8) {
|
||||
#if defined(GB_ARCH_64_BIT)
|
||||
n |= n >> 32;
|
||||
}
|
||||
#endif
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user