mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-24 14:45:00 -07:00
v0.3.0
This commit is contained in:
@@ -263,7 +263,7 @@ String get_fullpath_core(gbAllocator a, String path) {
|
||||
void init_build_context(void) {
|
||||
BuildContext *bc = &build_context;
|
||||
bc->ODIN_VENDOR = str_lit("odin");
|
||||
bc->ODIN_VERSION = str_lit("0.2.1");
|
||||
bc->ODIN_VERSION = str_lit("0.3.0");
|
||||
bc->ODIN_ROOT = odin_root_dir();
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
|
||||
@@ -2643,6 +2643,14 @@ bool check_is_castable_to(Checker *c, Operand *operand, Type *y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_type_bit_field_value(src) && is_type_integer(dst)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_type_bit_field_value(src) && is_type_boolean(dst)) {
|
||||
return src->BitFieldValue.bits == 1;
|
||||
}
|
||||
|
||||
// Cast between pointers
|
||||
if (is_type_pointer(src) && is_type_pointer(dst)) {
|
||||
Type *s = base_type(type_deref(src));
|
||||
|
||||
+13
-13
@@ -554,28 +554,28 @@ i128 i128_mul(i128 a, i128 b) {
|
||||
return res;
|
||||
}
|
||||
|
||||
void i128_divide(i128 num, i128 den, i128 *quo, i128 *rem) {
|
||||
void i128_divide(i128 a, i128 b, i128 *quo, i128 *rem) {
|
||||
// TODO(bill): Which one is correct?!
|
||||
#if 0
|
||||
i128 s = i128_shr(den, 127);
|
||||
den = i128_sub(i128_xor(den, s), s);
|
||||
s = i128_shr(num, 127);
|
||||
den = i128_sub(i128_xor(num, s), s);
|
||||
#if 1
|
||||
i128 s = i128_shr(b, 127);
|
||||
b = i128_sub(i128_xor(b, s), s);
|
||||
s = i128_shr(a, 127);
|
||||
b = i128_sub(i128_xor(a, s), s);
|
||||
|
||||
u128 n, r = {0};
|
||||
u128_divide(*cast(u128 *)&num, *cast(u128 *)&den, &n, &r);
|
||||
u128_divide(*cast(u128 *)&a, *cast(u128 *)&b, &n, &r);
|
||||
i128 ni = *cast(i128 *)&n;
|
||||
i128 ri = *cast(i128 *)&r;
|
||||
|
||||
if (quo) *quo = i128_sub(i128_xor(ni, s), s);
|
||||
if (rem) *rem = i128_sub(i128_xor(ri, s), s);
|
||||
if (quo) *quo = i128_sub(i128_xor(ri, s), s);
|
||||
if (rem) *rem = i128_sub(i128_xor(ni, s), s);
|
||||
#else
|
||||
if (i128_eq(den, I128_ZERO)) {
|
||||
if (quo) *quo = i128_from_u64(num.lo/den.lo);
|
||||
if (i128_eq(b, I128_ZERO)) {
|
||||
if (quo) *quo = i128_from_u64(a.lo/b.lo);
|
||||
if (rem) *rem = I128_ZERO;
|
||||
} else {
|
||||
i128 n = num;
|
||||
i128 d = den;
|
||||
i128 n = a;
|
||||
i128 d = b;
|
||||
i128 x = I128_ONE;
|
||||
i128 r = I128_ZERO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user