19
19
//! inputs, but we don't do so to avoid the code bloat. Each bignum is still
20
20
//! tracked for the actual usages, so it normally doesn't matter.
21
21
22
+ // This module is only for dec2flt and flt2dec, and only public because of libcoretest.
23
+ // It is not intended to ever be stabilized.
24
+ #![ doc( hidden) ]
25
+ #![ unstable( feature = "core_private_bignum" ,
26
+ reason = "internal routines only exposed for testing" ,
27
+ issue = "0" ) ]
22
28
#![ macro_use]
23
29
24
30
use prelude:: v1:: * ;
@@ -194,7 +200,7 @@ macro_rules! define_bignum {
194
200
/// Adds `other` to itself and returns its own mutable reference.
195
201
pub fn add<' a>( & ' a mut self , other: & $name) -> & ' a mut $name {
196
202
use cmp;
197
- use num:: flt2dec :: bignum:: FullOps ;
203
+ use num:: bignum:: FullOps ;
198
204
199
205
let mut sz = cmp:: max( self . size, other. size) ;
200
206
let mut carry = false ;
@@ -212,7 +218,7 @@ macro_rules! define_bignum {
212
218
}
213
219
214
220
pub fn add_small( & mut self , other: $ty) -> & mut $name {
215
- use num:: flt2dec :: bignum:: FullOps ;
221
+ use num:: bignum:: FullOps ;
216
222
217
223
let ( mut carry, v) = self . base[ 0 ] . full_add( other, false ) ;
218
224
self . base[ 0 ] = v;
@@ -232,7 +238,7 @@ macro_rules! define_bignum {
232
238
/// Subtracts `other` from itself and returns its own mutable reference.
233
239
pub fn sub<' a>( & ' a mut self , other: & $name) -> & ' a mut $name {
234
240
use cmp;
235
- use num:: flt2dec :: bignum:: FullOps ;
241
+ use num:: bignum:: FullOps ;
236
242
237
243
let sz = cmp:: max( self . size, other. size) ;
238
244
let mut noborrow = true ;
@@ -249,7 +255,7 @@ macro_rules! define_bignum {
249
255
/// Multiplies itself by a digit-sized `other` and returns its own
250
256
/// mutable reference.
251
257
pub fn mul_small( & mut self , other: $ty) -> & mut $name {
252
- use num:: flt2dec :: bignum:: FullOps ;
258
+ use num:: bignum:: FullOps ;
253
259
254
260
let mut sz = self . size;
255
261
let mut carry = 0 ;
@@ -310,7 +316,7 @@ macro_rules! define_bignum {
310
316
/// Multiplies itself by `5^e` and returns its own mutable reference.
311
317
pub fn mul_pow5( & mut self , mut e: usize ) -> & mut $name {
312
318
use mem;
313
- use num:: flt2dec :: bignum:: SMALL_POW5 ;
319
+ use num:: bignum:: SMALL_POW5 ;
314
320
315
321
// There are exactly n trailing zeros on 2^n, and the only relevant digit sizes
316
322
// are consecutive powers of two, so this is well suited index for the table.
@@ -341,7 +347,7 @@ macro_rules! define_bignum {
341
347
pub fn mul_digits<' a>( & ' a mut self , other: & [ $ty] ) -> & ' a mut $name {
342
348
// the internal routine. works best when aa.len() <= bb.len().
343
349
fn mul_inner( ret: & mut [ $ty; $n] , aa: & [ $ty] , bb: & [ $ty] ) -> usize {
344
- use num:: flt2dec :: bignum:: FullOps ;
350
+ use num:: bignum:: FullOps ;
345
351
346
352
let mut retsz = 0 ;
347
353
for ( i, & a) in aa. iter( ) . enumerate( ) {
@@ -378,7 +384,7 @@ macro_rules! define_bignum {
378
384
/// Divides itself by a digit-sized `other` and returns its own
379
385
/// mutable reference *and* the remainder.
380
386
pub fn div_rem_small( & mut self , other: $ty) -> ( & mut $name, $ty) {
381
- use num:: flt2dec :: bignum:: FullOps ;
387
+ use num:: bignum:: FullOps ;
382
388
383
389
assert!( other > 0 ) ;
384
390
0 commit comments