Remove pub(crate) to support rust 1.17.0

This commit is contained in:
David Tolnay
2018-08-04 19:27:34 -07:00
parent 9b3b59b6b7
commit 4e7eb8cc9e
8 changed files with 23 additions and 23 deletions
+4 -4
View File
@@ -22,7 +22,7 @@ use core::ptr;
// Returns e == 0 ? 1 : ceil(log_2(5^e)).
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn pow5bits(e: i32) -> u32 {
pub fn pow5bits(e: i32) -> u32 {
// This approximation works up to the point that the multiplication overflows at e = 3529.
// If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater
// than 2^9297.
@@ -33,7 +33,7 @@ pub(crate) fn pow5bits(e: i32) -> u32 {
// Returns floor(log_10(2^e)).
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn log10_pow2(e: i32) -> i32 {
pub fn log10_pow2(e: i32) -> i32 {
// The first value this approximation fails for is 2^1651 which is just greater than 10^297.
debug_assert!(e >= 0);
debug_assert!(e <= 1650);
@@ -42,7 +42,7 @@ pub(crate) fn log10_pow2(e: i32) -> i32 {
// Returns floor(log_10(5^e)).
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn log10_pow5(e: i32) -> i32 {
pub fn log10_pow5(e: i32) -> i32 {
// The first value this approximation fails for is 5^2621 which is just greater than 10^1832.
debug_assert!(e >= 0);
debug_assert!(e <= 2620);
@@ -50,7 +50,7 @@ pub(crate) fn log10_pow5(e: i32) -> i32 {
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) unsafe fn copy_special_str(result: *mut u8, sign: bool) -> usize {
pub unsafe fn copy_special_str(result: *mut u8, sign: bool) -> usize {
if sign {
ptr::write(result, b'-');
}
+5 -5
View File
@@ -29,8 +29,8 @@ use mulshift128::*;
#[cfg(feature = "no-panic")]
use no_panic::no_panic;
pub(crate) const DOUBLE_MANTISSA_BITS: u32 = 52;
pub(crate) const DOUBLE_EXPONENT_BITS: u32 = 11;
pub const DOUBLE_MANTISSA_BITS: u32 = 52;
pub const DOUBLE_EXPONENT_BITS: u32 = 11;
const DOUBLE_POW5_INV_BITCOUNT: i32 = 122;
const DOUBLE_POW5_BITCOUNT: i32 = 121;
@@ -128,7 +128,7 @@ fn mul_shift_all(
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn decimal_length(v: u64) -> u32 {
pub fn decimal_length(v: u64) -> u32 {
// This is slightly faster than a loop.
// The average output length is 16.38 digits, so we check high-to-low.
// Function precondition: v is not an 18, 19, or 20-digit number.
@@ -173,13 +173,13 @@ pub(crate) fn decimal_length(v: u64) -> u32 {
}
// A floating decimal representing m * 10^e.
pub(crate) struct FloatingDecimal64 {
pub struct FloatingDecimal64 {
pub mantissa: u64,
pub exponent: i32,
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn d2d(ieee_mantissa: u64, ieee_exponent: u32) -> FloatingDecimal64 {
pub fn d2d(ieee_mantissa: u64, ieee_exponent: u32) -> FloatingDecimal64 {
let bias = (1u32 << (DOUBLE_EXPONENT_BITS - 1)) - 1;
let (e2, m2) = if ieee_exponent == 0 {
+2 -2
View File
@@ -18,7 +18,7 @@
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
pub(crate) static DOUBLE_POW5_INV_SPLIT: [(u64, u64); 292] = [
pub static DOUBLE_POW5_INV_SPLIT: [(u64, u64); 292] = [
(1, 288230376151711744),
(3689348814741910324, 230584300921369395),
(2951479051793528259, 184467440737095516),
@@ -313,7 +313,7 @@ pub(crate) static DOUBLE_POW5_INV_SPLIT: [(u64, u64); 292] = [
(14258051472207991719, 179769313486231590),
];
pub(crate) static DOUBLE_POW5_SPLIT: [(u64, u64); 326] = [
pub static DOUBLE_POW5_SPLIT: [(u64, u64); 326] = [
(0, 72057594037927936),
(0, 90071992547409920),
(0, 112589990684262400),
+1 -1
View File
@@ -20,7 +20,7 @@
// A table of all two-digit numbers. This is used to speed up decimal digit
// generation by copying pairs of digits into the final output.
pub(crate) static DIGIT_TABLE: [u8; 200] = *b"\
pub static DIGIT_TABLE: [u8; 200] = *b"\
0001020304050607080910111213141516171819\
2021222324252627282930313233343536373839\
4041424344454647484950515253545556575859\
+5 -5
View File
@@ -26,8 +26,8 @@ use digit_table::*;
#[cfg(feature = "no-panic")]
use no_panic::no_panic;
pub(crate) const FLOAT_MANTISSA_BITS: u32 = 23;
pub(crate) const FLOAT_EXPONENT_BITS: u32 = 8;
pub const FLOAT_MANTISSA_BITS: u32 = 23;
pub const FLOAT_EXPONENT_BITS: u32 = 8;
const FLOAT_POW5_INV_BITCOUNT: i32 = 59;
const FLOAT_POW5_BITCOUNT: i32 = 61;
@@ -170,7 +170,7 @@ fn mul_pow5_div_pow2(m: u32, i: u32, j: i32) -> u32 {
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn decimal_length(v: u32) -> u32 {
pub fn decimal_length(v: u32) -> u32 {
// Function precondition: v is not a 10-digit number.
// (9 digits are sufficient for round-tripping.)
debug_assert!(v < 1000000000);
@@ -197,13 +197,13 @@ pub(crate) fn decimal_length(v: u32) -> u32 {
}
// A floating decimal representing m * 10^e.
pub(crate) struct FloatingDecimal32 {
pub struct FloatingDecimal32 {
pub mantissa: u32,
pub exponent: i32,
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) fn f2d(ieee_mantissa: u32, ieee_exponent: u32) -> FloatingDecimal32 {
pub fn f2d(ieee_mantissa: u32, ieee_exponent: u32) -> FloatingDecimal32 {
let bias = (1u32 << (FLOAT_EXPONENT_BITS - 1)) - 1;
let (e2, m2) = if ieee_exponent == 0 {
+2 -2
View File
@@ -3,7 +3,7 @@ use core::ptr;
use digit_table::*;
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) unsafe fn write_exponent3(mut k: isize, mut result: *mut u8) -> usize {
pub unsafe fn write_exponent3(mut k: isize, mut result: *mut u8) -> usize {
let sign = k < 0;
if sign {
*result = b'-';
@@ -28,7 +28,7 @@ pub(crate) unsafe fn write_exponent3(mut k: isize, mut result: *mut u8) -> usize
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) unsafe fn write_exponent2(mut k: isize, mut result: *mut u8) -> usize {
pub unsafe fn write_exponent2(mut k: isize, mut result: *mut u8) -> usize {
let sign = k < 0;
if sign {
*result = b'-';
+2 -2
View File
@@ -3,7 +3,7 @@ use core::ptr;
use digit_table::*;
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) unsafe fn write_mantissa_long(mut output: u64, mut result: *mut u8) {
pub unsafe fn write_mantissa_long(mut output: u64, mut result: *mut u8) {
if (output >> 32) != 0 {
// One expensive 64-bit division.
let mut output2 = (output - 100_000_000 * (output / 100_000_000)) as u32;
@@ -26,7 +26,7 @@ pub(crate) unsafe fn write_mantissa_long(mut output: u64, mut result: *mut u8) {
}
#[cfg_attr(feature = "no-panic", inline)]
pub(crate) unsafe fn write_mantissa(mut output: u32, mut result: *mut u8) {
pub unsafe fn write_mantissa(mut output: u32, mut result: *mut u8) {
while output >= 10_000 {
let c = (output - 10_000 * (output / 10_000)) as u32;
output /= 10_000;
+2 -2
View File
@@ -15,7 +15,7 @@ use no_panic::no_panic;
#[must_use]
#[cfg_attr(feature = "no-panic", no_panic)]
pub(crate) unsafe fn d2s_buffered_n(f: f64, result: *mut u8) -> usize {
pub unsafe fn d2s_buffered_n(f: f64, result: *mut u8) -> usize {
let bits = mem::transmute::<f64, u64>(f).to_le();
let sign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0;
let ieee_mantissa = bits & ((1u64 << DOUBLE_MANTISSA_BITS) - 1);
@@ -87,7 +87,7 @@ pub(crate) unsafe fn d2s_buffered_n(f: f64, result: *mut u8) -> usize {
#[must_use]
#[cfg_attr(feature = "no-panic", no_panic)]
pub(crate) unsafe fn f2s_buffered_n(f: f32, result: *mut u8) -> usize {
pub unsafe fn f2s_buffered_n(f: f32, result: *mut u8) -> usize {
let bits = mem::transmute::<f32, u32>(f).to_le();
let sign = ((bits >> (FLOAT_MANTISSA_BITS + FLOAT_EXPONENT_BITS)) & 1) != 0;
let ieee_mantissa = bits & ((1u32 << FLOAT_MANTISSA_BITS) - 1);