Skip to content

Commit c873216

Browse files
kud1inghuonw
kud1ing
authored andcommitted
bigint: backticks for code in documentation
1 parent d964f79 commit c873216

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

src/libextra/num/bigint.rs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
/*!
1212
13-
A Big integer (signed version: BigInt, unsigned version: BigUint).
13+
A Big integer (signed version: `BigInt`, unsigned version: `BigUint`).
1414
15-
A BigUint is represented as an array of BigDigits.
16-
A BigInt is a combination of BigUint and Sign.
15+
A `BigUint` is represented as an array of `BigDigit`s.
16+
A `BigInt` is a combination of `BigUint` and `Sign`.
1717
*/
1818

1919
#[allow(missing_doc)];
@@ -29,17 +29,17 @@ use std::uint;
2929
use std::vec;
3030

3131
/**
32-
A BigDigit is a BigUint's composing element.
32+
A `BigDigit` is a `BigUint`'s composing element.
3333
34-
A BigDigit is half the size of machine word size.
34+
A `BigDigit` is half the size of machine word size.
3535
*/
3636
#[cfg(target_word_size = "32")]
3737
pub type BigDigit = u16;
3838

3939
/**
40-
A BigDigit is a BigUint's composing element.
40+
A `BigDigit` is a `BigUint`'s composing element.
4141
42-
A BigDigit is half the size of machine word size.
42+
A `BigDigit` is half the size of machine word size.
4343
*/
4444
#[cfg(target_word_size = "64")]
4545
pub type BigDigit = u32;
@@ -64,13 +64,13 @@ pub mod BigDigit {
6464
#[inline]
6565
fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit }
6666

67-
/// Split one machine sized unsigned integer into two BigDigits.
67+
/// Split one machine sized unsigned integer into two `BigDigit`s.
6868
#[inline]
6969
pub fn from_uint(n: uint) -> (BigDigit, BigDigit) {
7070
(get_hi(n), get_lo(n))
7171
}
7272

73-
/// Join two BigDigits into one machine sized unsigned integer
73+
/// Join two `BigDigit`s into one machine sized unsigned integer
7474
#[inline]
7575
pub fn to_uint(hi: BigDigit, lo: BigDigit) -> uint {
7676
(lo as uint) | ((hi as uint) << bits)
@@ -80,8 +80,8 @@ pub mod BigDigit {
8080
/**
8181
A big unsigned integer type.
8282
83-
A BigUint-typed value BigUint { data: @[a, b, c] } represents a number
84-
(a + b * BigDigit::base + c * BigDigit::base^2).
83+
A `BigUint`-typed value `BigUint { data: @[a, b, c] }` represents a number
84+
`(a + b * BigDigit::base + c * BigDigit::base^2)`.
8585
*/
8686
#[deriving(Clone)]
8787
pub struct BigUint {
@@ -550,7 +550,7 @@ impl ToStrRadix for BigUint {
550550
}
551551

552552
impl FromStrRadix for BigUint {
553-
/// Creates and initializes an BigUint.
553+
/// Creates and initializes a `BigUint`.
554554
#[inline]
555555
fn from_str_radix(s: &str, radix: uint)
556556
-> Option<BigUint> {
@@ -559,7 +559,7 @@ impl FromStrRadix for BigUint {
559559
}
560560

561561
impl BigUint {
562-
/// Creates and initializes an BigUint.
562+
/// Creates and initializes a `BigUint`.
563563
#[inline]
564564
pub fn new(v: ~[BigDigit]) -> BigUint {
565565
// omit trailing zeros
@@ -571,7 +571,7 @@ impl BigUint {
571571
return BigUint { data: v };
572572
}
573573

574-
/// Creates and initializes an BigUint.
574+
/// Creates and initializes a `BigUint`.
575575
#[inline]
576576
pub fn from_uint(n: uint) -> BigUint {
577577
match BigDigit::from_uint(n) {
@@ -581,13 +581,13 @@ impl BigUint {
581581
}
582582
}
583583

584-
/// Creates and initializes an BigUint.
584+
/// Creates and initializes a `BigUint`.
585585
#[inline]
586586
pub fn from_slice(slice: &[BigDigit]) -> BigUint {
587587
return BigUint::new(slice.to_owned());
588588
}
589589

590-
/// Creates and initializes an BigUint.
590+
/// Creates and initializes a `BigUint`.
591591
pub fn parse_bytes(buf: &[u8], radix: uint)
592592
-> Option<BigUint> {
593593
let (base, unit_len) = get_radix_base(radix);
@@ -615,14 +615,14 @@ impl BigUint {
615615
}
616616

617617

618-
/// Converts this BigUint into a uint, failing if the conversion
618+
/// Converts this `BigUint` into a `uint`, failing if the conversion
619619
/// would overflow.
620620
#[inline]
621621
pub fn to_uint(&self) -> uint {
622622
self.to_uint_opt().expect("BigUint conversion would overflow uint")
623623
}
624624

625-
/// Converts this BigUint into a uint, unless it would overflow.
625+
/// Converts this `BigUint` into a `uint`, unless it would overflow.
626626
#[inline]
627627
pub fn to_uint_opt(&self) -> Option<uint> {
628628
match self.data.len() {
@@ -633,7 +633,7 @@ impl BigUint {
633633
}
634634
}
635635

636-
// Converts this BigUint into an int, unless it would overflow.
636+
/// Converts this `BigUint` into an `int`, unless it would overflow.
637637
pub fn to_int_opt(&self) -> Option<int> {
638638
self.to_uint_opt().and_then(|n| {
639639
// If top bit of uint is set, it's too large to convert to
@@ -646,7 +646,7 @@ impl BigUint {
646646
})
647647
}
648648

649-
/// Converts this BigUint into a BigInt.
649+
/// Converts this `BigUint` into a `BigInt`.
650650
#[inline]
651651
pub fn to_bigint(&self) -> BigInt {
652652
BigInt::from_biguint(Plus, self.clone())
@@ -698,7 +698,7 @@ impl BigUint {
698698
return BigUint::new(shifted);
699699
}
700700

701-
/// Determines the fewest bits necessary to express the BigUint.
701+
/// Determines the fewest bits necessary to express the `BigUint`.
702702
pub fn bits(&self) -> uint {
703703
if self.is_zero() { return 0; }
704704
let zeros = self.data.last().leading_zeros();
@@ -754,7 +754,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) {
754754
}
755755
}
756756

757-
/// A Sign is a BigInt's composing element.
757+
/// A Sign is a `BigInt`'s composing element.
758758
#[deriving(Eq, Clone)]
759759
pub enum Sign { Minus, Zero, Plus }
760760

@@ -1117,22 +1117,22 @@ impl FromStrRadix for BigInt {
11171117
}
11181118
11191119
trait RandBigInt {
1120-
/// Generate a random BigUint of the given bit size.
1120+
/// Generate a random `BigUint` of the given bit size.
11211121
fn gen_biguint(&mut self, bit_size: uint) -> BigUint;
11221122
11231123
/// Generate a random BigInt of the given bit size.
11241124
fn gen_bigint(&mut self, bit_size: uint) -> BigInt;
11251125
1126-
/// Generate a random BigUint less than the given bound. Fails
1126+
/// Generate a random `BigUint` less than the given bound. Fails
11271127
/// when the bound is zero.
11281128
fn gen_biguint_below(&mut self, bound: &BigUint) -> BigUint;
11291129
1130-
/// Generate a random BigUint within the given range. The lower
1130+
/// Generate a random `BigUint` within the given range. The lower
11311131
/// bound is inclusive; the upper bound is exclusive. Fails when
11321132
/// the upper bound is not greater than the lower bound.
11331133
fn gen_biguint_range(&mut self, lbound: &BigUint, ubound: &BigUint) -> BigUint;
11341134
1135-
/// Generate a random BigInt within the given range. The lower
1135+
/// Generate a random `BigInt` within the given range. The lower
11361136
/// bound is inclusive; the upper bound is exclusive. Fails when
11371137
/// the upper bound is not greater than the lower bound.
11381138
fn gen_bigint_range(&mut self, lbound: &BigInt, ubound: &BigInt) -> BigInt;
@@ -1208,7 +1208,7 @@ impl BigInt {
12081208
BigInt::from_biguint(sign, BigUint::new(v))
12091209
}
12101210
1211-
/// Creates and initializes an BigInt.
1211+
/// Creates and initializes a `BigInt`.
12121212
#[inline]
12131213
pub fn from_biguint(sign: Sign, data: BigUint) -> BigInt {
12141214
if sign == Zero || data.is_zero() {
@@ -1217,20 +1217,20 @@ impl BigInt {
12171217
return BigInt { sign: sign, data: data };
12181218
}
12191219
1220-
/// Creates and initializes an BigInt.
1220+
/// Creates and initializes a `BigInt`.
12211221
#[inline]
12221222
pub fn from_uint(n: uint) -> BigInt {
12231223
if n == 0 { return Zero::zero(); }
12241224
return BigInt::from_biguint(Plus, BigUint::from_uint(n));
12251225
}
12261226
1227-
/// Creates and initializes an BigInt.
1227+
/// Creates and initializes a `BigInt`.
12281228
#[inline]
12291229
pub fn from_slice(sign: Sign, slice: &[BigDigit]) -> BigInt {
12301230
BigInt::from_biguint(sign, BigUint::from_slice(slice))
12311231
}
12321232
1233-
/// Creates and initializes an BigInt.
1233+
/// Creates and initializes a `BigInt`.
12341234
pub fn parse_bytes(buf: &[u8], radix: uint)
12351235
-> Option<BigInt> {
12361236
if buf.is_empty() { return None; }
@@ -1244,14 +1244,14 @@ impl BigInt {
12441244
.map_move(|bu| BigInt::from_biguint(sign, bu));
12451245
}
12461246
1247-
/// Converts this BigInt into a uint, failing if the conversion
1247+
/// Converts this `BigInt` into a `uint`, failing if the conversion
12481248
/// would overflow.
12491249
#[inline]
12501250
pub fn to_uint(&self) -> uint {
12511251
self.to_uint_opt().expect("BigInt conversion would overflow uint")
12521252
}
12531253

1254-
/// Converts this BigInt into a uint, unless it would overflow.
1254+
/// Converts this `BigInt` into a `uint`, unless it would overflow.
12551255
#[inline]
12561256
pub fn to_uint_opt(&self) -> Option<uint> {
12571257
match self.sign {
@@ -1261,7 +1261,7 @@ impl BigInt {
12611261
}
12621262
}
12631263

1264-
/// Converts this BigInt into an int, unless it would overflow.
1264+
/// Converts this `BigInt` into an `int`, unless it would overflow.
12651265
pub fn to_int_opt(&self) -> Option<int> {
12661266
match self.sign {
12671267
Plus => self.data.to_int_opt(),
@@ -1279,14 +1279,14 @@ impl BigInt {
12791279
}
12801280
}
12811281

1282-
/// Converts this BigInt into a BigUint, failing if BigInt is
1282+
/// Converts this `BigInt` into a `BigUint`, failing if BigInt is
12831283
/// negative.
12841284
#[inline]
12851285
pub fn to_biguint(&self) -> BigUint {
12861286
self.to_biguint_opt().expect("negative BigInt cannot convert to BigUint")
12871287
}
12881288

1289-
/// Converts this BigInt into a BigUint, if it's not negative.
1289+
/// Converts this `BigInt` into a `BigUint`, if it's not negative.
12901290
#[inline]
12911291
pub fn to_biguint_opt(&self) -> Option<BigUint> {
12921292
match self.sign {

0 commit comments

Comments
 (0)