diff options
| author | Patrick Walton <[email protected]> | 2011-03-18 18:49:59 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-18 18:49:59 -0700 |
| commit | 3f2bae4449b6eac3e970b033763905da5bb3a4f1 (patch) | |
| tree | 105657f60b6b8848be615522ec8e6bff49445a3d /src/comp/middle | |
| parent | rustc: Make trans_path() generic-safe wrt nullary tags (diff) | |
| download | rust-3f2bae4449b6eac3e970b033763905da5bb3a4f1.tar.xz rust-3f2bae4449b6eac3e970b033763905da5bb3a4f1.zip | |
rustc: Implement int-to-native casts
Diffstat (limited to 'src/comp/middle')
| -rw-r--r-- | src/comp/middle/trans.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 8bbd9fa2..71f0d65c 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3585,8 +3585,11 @@ fn trans_cast(@block_ctxt cx, @ast.expr e, &ast.ann ann) -> result { auto t = node_ann_type(cx.fcx.ccx, ann); auto lldsttype = type_of(cx.fcx.ccx, t); if (!ty.type_is_fp(t)) { + // TODO: native-to-native casts if (ty.type_is_native(ty.expr_ty(e))) { e_res.val = e_res.bcx.build.PtrToInt(e_res.val, lldsttype); + } else if (ty.type_is_native(t)) { + e_res.val = e_res.bcx.build.IntToPtr(e_res.val, lldsttype); } else if (llvm.LLVMGetIntTypeWidth(lldsttype) > llvm.LLVMGetIntTypeWidth(llsrctype)) { if (ty.type_is_signed(t)) { |