Skip to content

Commit

Permalink
Remove float imports ready for v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacholt100 committed Jul 23, 2023
1 parent 095807b commit a575c97
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/buint/as_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ macro_rules! impl_mantissa_for_uint {

impl_mantissa_for_uint!(u32, u64);

macro_rules! impl_mantissa_for_buint {
/*macro_rules! impl_mantissa_for_buint {
($BUint: ident, $BInt: ident, $Digit: ident) => {
impl<const N: usize> Mantissa for $BUint<N> {
const ONE: Self = Self::ONE;
Expand Down Expand Up @@ -258,7 +258,7 @@ macro_rules! impl_mantissa_for_buint {
pub(crate) use impl_mantissa_for_buint;
crate::macro_impl!(impl_mantissa_for_buint);
crate::macro_impl!(impl_mantissa_for_buint);*/

pub fn cast_float_from_uint<F, U>(from: U) -> F
where
Expand Down
4 changes: 2 additions & 2 deletions src/buint/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ macro_rules! cast {
crate::nightly::const_fn! {
#[inline]
const fn cast_up<const M: usize>(self, digit: $Digit) -> $BUint<M> {
let mut digits = [digit; M];
let digits = [digit; M];
let digits_ptr = digits.as_ptr().cast_mut() as *mut $Digit; // TODO: can change to as_mut_ptr() when const_mut_refs is stabilised
let self_ptr = self.digits.as_ptr();
unsafe {
Expand All @@ -153,7 +153,7 @@ macro_rules! cast {
crate::nightly::const_fn! {
#[inline]
const fn cast_down<const M: usize>(self) -> $BUint<M> {
let mut digits = MaybeUninit::<[$Digit; M]>::uninit();
let digits = MaybeUninit::<[$Digit; M]>::uninit();
let digits_ptr = digits.as_ptr().cast_mut() as *mut $Digit; // TODO: can change to as_mut_ptr() when const_mut_refs is stabilised
let self_ptr = self.digits.as_ptr();

Expand Down
4 changes: 2 additions & 2 deletions src/buint/endian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ macro_rules! endian {
let arr_ptr = bytes.as_ptr();
let mut i = 0;
while i < N {
let mut uninit = MaybeUninit::<[u8; digit::$Digit::BYTES as usize]>::uninit();
let uninit = MaybeUninit::<[u8; digit::$Digit::BYTES as usize]>::uninit();
let ptr = uninit.as_ptr().cast_mut() as *mut u8; // TODO: can change to as_mut_ptr() when const_mut_refs is stabilised
let digit_bytes = unsafe {
arr_ptr
Expand All @@ -265,7 +265,7 @@ macro_rules! endian {
let arr_ptr = bytes.as_ptr();
let mut i = 0;
while i < N {
let mut uninit = MaybeUninit::<[u8; digit::$Digit::BYTES as usize]>::uninit();
let uninit = MaybeUninit::<[u8; digit::$Digit::BYTES as usize]>::uninit();
let ptr = uninit.as_ptr().cast_mut() as *mut u8; // TODO: can change to as_mut_ptr() when const_mut_refs is stabilised
let digit_bytes = unsafe {
arr_ptr
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ pub mod random;

pub mod types;

#[cfg(feature = "nightly")]
/*#[cfg(feature = "nightly")]
mod float;
#[cfg(feature = "nightly")]
pub use float::Float;
pub use float::Float;*/

#[cfg(test)]
mod test;

#[cfg(test)]
use test::types::*;

#[cfg(feature = "usize_exptype")]
/*#[cfg(feature = "usize_exptype")]
type ExpType = usize;
#[cfg(not(feature = "usize_exptype"))]
#[cfg(not(feature = "usize_exptype"))]*/
type ExpType = u32;

macro_rules! macro_impl {
Expand Down
4 changes: 2 additions & 2 deletions src/test/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl TestConvert for f32 {
}
}

#[cfg(feature = "nightly")]
/*#[cfg(feature = "nightly")]
impl TestConvert for crate::float::F64 {
type Output = u64;
Expand All @@ -89,7 +89,7 @@ impl TestConvert for crate::float::F32 {
self.to_bits().as_()
}
}
}*/

impl<T: TestConvert, U: TestConvert> TestConvert for (T, U) {
type Output = (<T as TestConvert>::Output, <U as TestConvert>::Output);
Expand Down
3 changes: 2 additions & 1 deletion src/test/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod small_types {
pub use core::primitive::*;
pub use small_types::*;

#[cfg(test_int_bits = "64")]
/*#[cfg(test_int_bits = "64")]
#[allow(non_camel_case_types)]
pub type ftest = f64;
Expand All @@ -63,3 +63,4 @@ pub type FTEST = crate::float::Float<8, 52>;
#[cfg(feature = "nightly")]
#[cfg(not(test_int_bits = "64"))]
pub type FTEST = crate::float::Float<4, 23>;
*/

0 comments on commit a575c97

Please sign in to comment.