Skip to content

Commit ee6256b

Browse files
committed
More windows fixes
1 parent 9842d27 commit ee6256b

File tree

1 file changed

+15
-7
lines changed
  • src/libcompiler_builtins

1 file changed

+15
-7
lines changed

src/libcompiler_builtins/lib.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,21 @@ pub mod reimpls {
378378
if b != 0 && b != 1 {
379379
*overflow = 1;
380380
}
381-
return result.to_ret();
381+
return result;
382382
}
383383
if b == <$ty>::min_value() {
384384
if a != 0 && a != 1 {
385385
*overflow = 1;
386386
}
387-
return result.to_ret();
387+
return result;
388388
}
389389

390390
let sa = a.signum();
391391
let abs_a = a.iabs();
392392
let sb = b.signum();
393393
let abs_b = b.iabs();
394394
if abs_a < 2 || abs_b < 2 {
395-
return result.to_ret();
395+
return result;
396396
}
397397
unsafe {
398398
if sa == sb {
@@ -405,13 +405,14 @@ pub mod reimpls {
405405
}
406406
}
407407
}
408-
result.to_ret()
408+
result
409409
}}
410410
}
411411

412412
// FIXME: i32 here should be c_int.
413-
#[export_name="__muloti4"]
414-
pub extern "C" fn i128_mul_oflow(a: i128_, b: i128_, o: &mut i32) -> i128ret {
413+
#[cfg_attr(not(all(windows, target_pointer_width="64", not(stage0))),
414+
export_name="__muloti4")]
415+
pub extern "C" fn i128_mul_oflow(a: i128_, b: i128_, o: &mut i32) -> i128 {
415416
mulo!(a, b, o, i128_)
416417
}
417418

@@ -696,7 +697,14 @@ pub mod reimpls {
696697
#[cfg(all(windows, target_pointer_width="64"))]
697698
mod windows_64_workarounds {
698699
use super::{i128_, u128_, LargeInt};
699-
use super::{i128_as_f64, i128_as_f32, u128_as_f64, u128_as_f32};
700+
use super::{i128_as_f64, i128_as_f32, u128_as_f64, u128_as_f32, i128_mul_oflow};
701+
702+
#[export_name="__muloti4"]
703+
pub extern "C" fn i128_mul_oflow_win(alow: u64, ahigh: i64,
704+
blow: u64, bhigh: i64, o: &mut i32) -> i128 {
705+
i128_mul_oflow(i128_::from_parts(alow, ahigh), i128_::from_parts(blow, bhigh), o)
706+
}
707+
700708
#[export_name="__floattidf"]
701709
pub extern "C" fn i128_as_f64_win(alow: u64, ahigh: i64) -> f64 {
702710
i128_as_f64(i128_::from_parts(alow, ahigh))

0 commit comments

Comments
 (0)