|
@@ -228,6 +228,7 @@ pub extern "C" fn __udivmoddi4(n: u64, d: u64, rem: Option<&mut u64>) -> u64 {
|
|
|
|
|
|
#[cfg(test)]
|
|
|
mod tests {
|
|
|
+ use gcc_s;
|
|
|
use quickcheck::TestResult;
|
|
|
use qc::{U32, U64};
|
|
|
|
|
@@ -238,7 +239,12 @@ mod tests {
|
|
|
TestResult::discard()
|
|
|
} else {
|
|
|
let q = super::__udivdi3(n, d);
|
|
|
- TestResult::from_bool(q == n / d)
|
|
|
+
|
|
|
+ if let Some(udivdi3) = gcc_s::udivdi3() {
|
|
|
+ TestResult::from_bool(q == unsafe { udivdi3(n, d) })
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(q == n / d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -248,7 +254,12 @@ mod tests {
|
|
|
TestResult::discard()
|
|
|
} else {
|
|
|
let r = super::__umoddi3(n, d);
|
|
|
- TestResult::from_bool(r == n % d)
|
|
|
+
|
|
|
+ if let Some(umoddi3) = gcc_s::umoddi3() {
|
|
|
+ TestResult::from_bool(r == unsafe { umoddi3(n, d) })
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(r == n % d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -259,7 +270,17 @@ mod tests {
|
|
|
} else {
|
|
|
let mut r = 0;
|
|
|
let q = super::__udivmoddi4(n, d, Some(&mut r));
|
|
|
- TestResult::from_bool(q == n / d && r == n % d)
|
|
|
+
|
|
|
+ if let Some(udivmoddi4) = gcc_s::udivmoddi4() {
|
|
|
+ let mut gcc_s_r = 0;
|
|
|
+ let gcc_s_q = unsafe {
|
|
|
+ udivmoddi4(n, d, Some(&mut gcc_s_r))
|
|
|
+ };
|
|
|
+
|
|
|
+ TestResult::from_bool(q == gcc_s_q && r == gcc_s_r)
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(q == n / d && r == n % d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -269,7 +290,12 @@ mod tests {
|
|
|
TestResult::discard()
|
|
|
} else {
|
|
|
let q = super::__udivsi3(n, d);
|
|
|
- TestResult::from_bool(q == n / d)
|
|
|
+
|
|
|
+ if let Some(udivsi3) = gcc_s::udivsi3() {
|
|
|
+ TestResult::from_bool(q == unsafe { udivsi3(n, d) })
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(q == n / d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -279,7 +305,12 @@ mod tests {
|
|
|
TestResult::discard()
|
|
|
} else {
|
|
|
let r = super::__umodsi3(n, d);
|
|
|
- TestResult::from_bool(r == n % d)
|
|
|
+
|
|
|
+ if let Some(umodsi3) = gcc_s::umodsi3() {
|
|
|
+ TestResult::from_bool(r == unsafe { umodsi3(n, d) })
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(r == n % d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -290,7 +321,17 @@ mod tests {
|
|
|
} else {
|
|
|
let mut r = 0;
|
|
|
let q = super::__udivmodsi4(n, d, Some(&mut r));
|
|
|
- TestResult::from_bool(q == n / d && r == n % d)
|
|
|
+
|
|
|
+ if let Some(udivmodsi4) = gcc_s::udivmodsi4() {
|
|
|
+ let mut gcc_s_r = 0;
|
|
|
+ let gcc_s_q = unsafe {
|
|
|
+ udivmodsi4(n, d, Some(&mut gcc_s_r))
|
|
|
+ };
|
|
|
+
|
|
|
+ TestResult::from_bool(q == gcc_s_q && r == gcc_s_r)
|
|
|
+ } else {
|
|
|
+ TestResult::from_bool(q == n / d && r == n % d)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|