File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
//! Utilities for working with hex float formats.
2
2
3
- #![ allow( dead_code) ] // FIXME: remove once this gets used
4
-
5
3
use core:: fmt;
6
4
7
5
use super :: { Float , f32_from_bits, f64_from_bits} ;
@@ -13,6 +11,7 @@ pub const fn hf16(s: &str) -> f16 {
13
11
}
14
12
15
13
/// Construct a 32-bit float from hex float representation (C-style)
14
+ #[ allow( unused) ]
16
15
pub const fn hf32 ( s : & str ) -> f32 {
17
16
f32_from_bits ( parse_any ( s, 32 , 23 ) as u32 )
18
17
}
@@ -548,14 +547,12 @@ mod parse_tests {
548
547
549
548
#[ test]
550
549
fn test_macros ( ) {
551
- // FIXME(msrv): enable once parsing works
552
- // #[cfg(f16_enabled)]
553
- // assert_eq!(hf16!("0x1.ffp+8").to_bits(), 0x5ffc_u16);
550
+ #[ cfg( f16_enabled) ]
551
+ assert_eq ! ( hf16!( "0x1.ffp+8" ) . to_bits( ) , 0x5ffc_u16 ) ;
554
552
assert_eq ! ( hf32!( "0x1.ffep+8" ) . to_bits( ) , 0x43fff000_u32 ) ;
555
553
assert_eq ! ( hf64!( "0x1.ffep+8" ) . to_bits( ) , 0x407ffe0000000000_u64 ) ;
556
- // FIXME(msrv): enable once parsing works
557
- // #[cfg(f128_enabled)]
558
- // assert_eq!(hf128!("0x1.ffep+8").to_bits(), 0x4007ffe0000000000000000000000000_u128);
554
+ #[ cfg( f128_enabled) ]
555
+ assert_eq ! ( hf128!( "0x1.ffep+8" ) . to_bits( ) , 0x4007ffe0000000000000000000000000_u128 ) ;
559
556
}
560
557
}
561
558
You can’t perform that action at this time.
0 commit comments