1
Fork 0

Use bitcast for ptrtoint and inttoptr

This works now
This commit is contained in:
bjorn3 2022-02-25 15:36:08 +01:00
parent b48ed38482
commit 07afdb8c0d
2 changed files with 5 additions and 29 deletions

View file

@ -904,11 +904,12 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
}
fn ptrtoint(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> {
self.cx.ptrtoint(self.block, value, dest_ty)
let usize_value = self.cx.const_bitcast(value, self.cx.type_isize());
self.intcast(usize_value, dest_ty, false)
}
fn inttoptr(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> {
self.cx.inttoptr(self.block, value, dest_ty)
self.cx.const_bitcast(value, dest_ty)
}
fn bitcast(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> {