This commit is contained in:
Ralf Jung 2022-08-10 08:03:00 -04:00
parent 5aef34c016
commit 591274bbd9
4 changed files with 9 additions and 11 deletions

View File

@ -1 +1 @@
6d3f1beae1720055e5a30f4dbe7a9e7fb810c65e
1603a70f82240ba2d27f72f964e36614d7620ad3

View File

@ -1,8 +1,6 @@
//@compile-flags: -Zmiri-disable-isolation
//@rustc-env: RUST_BACKTRACE=1
#![feature(backtrace)]
use std::alloc::System;
use std::backtrace::Backtrace;

View File

@ -1,8 +1,6 @@
//@compile-flags: -Zmiri-disable-isolation
//@rustc-env: RUST_BACKTRACE=1
#![feature(backtrace)]
use std::backtrace::Backtrace;
#[inline(never)]

View File

@ -176,10 +176,12 @@ pub fn main() {
// Logarithms
macro_rules! test_log {
($type:ident, $max_log2:expr, $max_log10:expr) => {
assert_eq!($type::MIN.checked_log2(), None);
assert_eq!($type::MIN.checked_log10(), None);
assert_eq!($type::MAX.checked_log2(), Some($max_log2));
assert_eq!($type::MAX.checked_log10(), Some($max_log10));
assert_eq!($type::MIN.checked_ilog2(), None);
assert_eq!($type::MIN.checked_ilog10(), None);
assert_eq!($type::MAX.checked_ilog2(), Some($max_log2));
assert_eq!($type::MAX.checked_ilog10(), Some($max_log10));
assert_eq!($type::MAX.ilog2(), $max_log2);
assert_eq!($type::MAX.ilog10(), $max_log10);
};
}
@ -195,9 +197,9 @@ pub fn main() {
test_log!(u128, 127, 38);
for i in (1..=i16::MAX).step_by(i8::MAX as usize) {
assert_eq!(i.checked_log(13), Some((i as f32).log(13.0) as u32));
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32));
}
for i in (1..=u16::MAX).step_by(i8::MAX as usize) {
assert_eq!(i.checked_log(13), Some((i as f32).log(13.0) as u32));
assert_eq!(i.checked_ilog(13), Some((i as f32).log(13.0) as u32));
}
}