File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2
2
members = [" fuzz" ]
3
3
4
4
[workspace .package ]
5
- version = " 0.2.0+llvm-4dc08de9d2f6 "
5
+ version = " 0.2.0+llvm-038f7debfda0 "
6
6
edition = " 2021"
7
7
license = " Apache-2.0 WITH LLVM-exception"
8
8
Original file line number Diff line number Diff line change 1
1
//! Port of LLVM's APFloat software floating-point implementation from the
2
2
//! following C++ sources (please update commit hash when backporting):
3
- //! https://github.com/llvm/llvm-project/commit/4dc08de9d2f680309cdd639169d3b8802c76ae9a
3
+ //! https://github.com/llvm/llvm-project/commit/038f7debfda01471ce0d4eb1fed20da61e5c8b32
4
4
//! * `llvm/include/llvm/ADT/APFloat.h` -> `Float` and `FloatConvert` traits
5
5
//! * `llvm/lib/Support/APFloat.cpp` -> `ieee` and `ppc` modules
6
6
//! * `llvm/unittests/ADT/APFloatTest.cpp` -> `tests` directory
@@ -263,6 +263,16 @@ pub trait Float:
263
263
// FIXME(eddyb) provide a default when qnan becomes const fn.
264
264
const NAN : Self ;
265
265
266
+ /// Number of bits needed to represent the largest integer that
267
+ /// the floating point type can hold.
268
+ // FIXME should be const fn.
269
+ fn max_int_bits ( signed : bool ) -> usize {
270
+ // The max FP value is pow(2, MaxExponent) * (1 + MaxFraction), so we need
271
+ // at least one more bit than the MaxExponent to hold the max FP value.
272
+ // Another extra sign bit is needed for signed integers.
273
+ Self :: MAX_EXP as usize + 1 + ( signed as usize )
274
+ }
275
+
266
276
/// Factory for QNaN values.
267
277
// FIXME(eddyb) should be const fn.
268
278
fn qnan ( payload : Option < u128 > ) -> Self ;
You can’t perform that action at this time.
0 commit comments