compiler-builtins-zynq/src/riscv32.rs

19 lines
415 B
Rust
Raw Permalink Normal View History

2018-07-27 01:30:26 +08:00
intrinsics! {
// Implementation from gcc
// https://raw.githubusercontent.com/gcc-mirror/gcc/master/libgcc/config/epiphany/mulsi3.c
2018-08-31 05:13:15 +08:00
pub extern "C" fn __mulsi3(a: u32, b: u32) -> u32 {
let (mut a, mut b) = (a, b);
2018-09-01 07:00:12 +08:00
let mut r = 0;
2018-07-27 01:30:26 +08:00
while a > 0 {
if a & 1 > 0 {
r += b;
}
a >>= 1;
b <<= 1;
}
r
}
}