mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-13 16:25:25 +00:00
Merge branch 'master' into windows-llvm-11.1.0
This commit is contained in:
@@ -179,32 +179,24 @@ lbValue lb_emit_transmute(lbProcedure *p, lbValue value, Type *t) {
|
||||
GB_ASSERT_MSG(sz == dz, "Invalid transmute conversion: '%s' to '%s'", type_to_string(src_type), type_to_string(t));
|
||||
|
||||
// NOTE(bill): Casting between an integer and a pointer cannot be done through a bitcast
|
||||
if (is_type_uintptr(src) && is_type_pointer(dst)) {
|
||||
if (is_type_uintptr(src) && is_type_internally_pointer_like(dst)) {
|
||||
res.value = LLVMBuildIntToPtr(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
}
|
||||
if (is_type_pointer(src) && is_type_uintptr(dst)) {
|
||||
res.value = LLVMBuildPtrToInt(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
}
|
||||
if (is_type_uintptr(src) && is_type_proc(dst)) {
|
||||
res.value = LLVMBuildIntToPtr(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
}
|
||||
if (is_type_proc(src) && is_type_uintptr(dst)) {
|
||||
if (is_type_internally_pointer_like(src) && is_type_uintptr(dst)) {
|
||||
res.value = LLVMBuildPtrToInt(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
}
|
||||
|
||||
if (is_type_integer(src) && (is_type_pointer(dst) || is_type_cstring(dst))) {
|
||||
if (is_type_integer(src) && is_type_internally_pointer_like(dst)) {
|
||||
res.value = LLVMBuildIntToPtr(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
} else if ((is_type_pointer(src) || is_type_cstring(src)) && is_type_integer(dst)) {
|
||||
} else if (is_type_internally_pointer_like(src) && is_type_integer(dst)) {
|
||||
res.value = LLVMBuildPtrToInt(p->builder, value.value, lb_type(m, t), "");
|
||||
return res;
|
||||
}
|
||||
|
||||
if (is_type_pointer(src) && is_type_pointer(dst)) {
|
||||
if (is_type_internally_pointer_like(src) && is_type_internally_pointer_like(dst)) {
|
||||
res.value = LLVMBuildPointerCast(p->builder, value.value, lb_type(p->module, t), "");
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -697,6 +697,7 @@ Type * bit_set_to_int(Type *t);
|
||||
bool are_types_identical(Type *x, Type *y);
|
||||
|
||||
bool is_type_pointer(Type *t);
|
||||
bool is_type_proc(Type *t);
|
||||
bool is_type_slice(Type *t);
|
||||
bool is_type_integer(Type *t);
|
||||
bool type_set_offsets(Type *t);
|
||||
@@ -1284,6 +1285,10 @@ bool is_type_multi_pointer(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_MultiPointer;
|
||||
}
|
||||
bool is_type_internally_pointer_like(Type *t) {
|
||||
return is_type_pointer(t) || is_type_multi_pointer(t) || is_type_cstring(t) || is_type_proc(t);
|
||||
}
|
||||
|
||||
bool is_type_tuple(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_Tuple;
|
||||
|
||||
3
vendor/raylib/raylib.odin
vendored
3
vendor/raylib/raylib.odin
vendored
@@ -1077,6 +1077,7 @@ foreign lib {
|
||||
GetMouseX :: proc() -> c.int --- // Returns mouse position X
|
||||
GetMouseY :: proc() -> c.int --- // Returns mouse position Y
|
||||
GetMousePosition :: proc() -> Vector2 --- // Returns mouse position XY
|
||||
GetMouseDelta :: proc() -> Vector2 --- // Returns mouse delta XY
|
||||
SetMousePosition :: proc(x, y: c.int) --- // Set mouse position XY
|
||||
SetMouseOffset :: proc(offsetX, offsetY: c.int) --- // Set mouse offset
|
||||
SetMouseScale :: proc(scaleX, scaleY: f32) --- // Set mouse scaling
|
||||
@@ -1568,4 +1569,4 @@ MemAllocatorProc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
||||
return nil, .Mode_Not_Implemented
|
||||
}
|
||||
return nil, .Mode_Not_Implemented
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user