Skip to content

Commit

Permalink
bitv: backticks for code in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kud1ing authored and huonw committed Sep 26, 2013
1 parent c873216 commit 3165dde
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/libextra/bitv.rs
Expand Up @@ -116,7 +116,7 @@ struct BigBitv {
}

/**
* a mask that has a 1 for each defined bit in the nth element of a big_bitv,
* A mask that has a 1 for each defined bit in the n'th element of a `BigBitv`,
* assuming n bits.
*/
#[inline]
Expand Down Expand Up @@ -284,7 +284,7 @@ impl Bitv {
* Calculates the union of two bitvectors
*
* Sets `self` to the union of `self` and `v1`. Both bitvectors must be
* the same length. Returns 'true' if `self` changed.
* the same length. Returns `true` if `self` changed.
*/
#[inline]
pub fn union(&mut self, v1: &Bitv) -> bool { self.do_op(Union, v1) }
Expand All @@ -293,7 +293,7 @@ impl Bitv {
* Calculates the intersection of two bitvectors
*
* Sets `self` to the intersection of `self` and `v1`. Both bitvectors
* must be the same length. Returns 'true' if `self` changed.
* must be the same length. Returns `true` if `self` changed.
*/
#[inline]
pub fn intersect(&mut self, v1: &Bitv) -> bool {
Expand Down Expand Up @@ -395,7 +395,7 @@ impl Bitv {
self.do_op(Difference, v)
}

/// Returns true if all bits are 1
/// Returns `true` if all bits are 1
#[inline]
pub fn is_true(&self) -> bool {
match self.rep {
Expand All @@ -417,7 +417,7 @@ impl Bitv {
self.iter().invert()
}

/// Returns true if all bits are 0
/// Returns `true` if all bits are 0
pub fn is_false(&self) -> bool {
match self.rep {
Small(ref b) => b.is_false(self.nbits),
Expand All @@ -433,18 +433,18 @@ impl Bitv {
}

/**
* Converts `self` to a vector of uint with the same length.
* Converts `self` to a vector of `uint` with the same length.
*
* Each uint in the resulting vector has either value 0u or 1u.
* Each `uint` in the resulting vector has either value `0u` or `1u`.
*/
pub fn to_vec(&self) -> ~[uint] {
vec::from_fn(self.nbits, |x| self.init_to_vec(x))
}

/**
* Organise the bits into bytes, such that the first bit in the
* bitv becomes the high-order bit of the first byte. If the
* size of the bitv is not a multiple of 8 then trailing bits
* `Bitv` becomes the high-order bit of the first byte. If the
* size of the `Bitv` is not a multiple of 8 then trailing bits
* will be filled-in with false/0
*/
pub fn to_bytes(&self) -> ~[u8] {
Expand Down Expand Up @@ -472,7 +472,7 @@ impl Bitv {
}

/**
* Transform self into a [bool] by turning each bit into a bool
* Transform `self` into a `[bool]` by turning each bit into a `bool`.
*/
pub fn to_bools(&self) -> ~[bool] {
vec::from_fn(self.nbits, |i| self[i])
Expand All @@ -498,7 +498,7 @@ impl Bitv {


/**
* Compare a bitvector to a vector of bool.
* Compare a bitvector to a vector of `bool`.
*
* Both the bitvector and vector must have the same length.
*/
Expand All @@ -519,9 +519,9 @@ impl Bitv {
}

/**
* Transform a byte-vector into a bitv. Each byte becomes 8 bits,
* Transform a byte-vector into a `Bitv`. Each byte becomes 8 bits,
* with the most significant bits of each byte coming first. Each
* bit becomes true if equal to 1 or false if equal to 0.
* bit becomes `true` if equal to 1 or `false` if equal to 0.
*/
pub fn from_utf8(bytes: &[u8]) -> Bitv {
from_fn(bytes.len() * 8, |i| {
Expand All @@ -532,15 +532,15 @@ pub fn from_utf8(bytes: &[u8]) -> Bitv {
}

/**
* Transform a [bool] into a bitv by converting each bool into a bit.
* Transform a `[bool]` into a `Bitv` by converting each `bool` into a bit.
*/
pub fn from_bools(bools: &[bool]) -> Bitv {
from_fn(bools.len(), |i| bools[i])
}

/**
* Create a bitv of the specified length where the value at each
* index is f(index).
* Create a `Bitv` of the specified length where the value at each
* index is `f(index)`.
*/
pub fn from_fn(len: uint, f: &fn(index: uint) -> bool) -> Bitv {
let mut bitv = Bitv::new(len, false);
Expand Down Expand Up @@ -571,7 +571,7 @@ fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool {
return true;
}

/// An iterator for Bitv
/// An iterator for `Bitv`.
pub struct BitvIterator<'self> {
priv bitv: &'self Bitv,
priv next_idx: uint,
Expand Down Expand Up @@ -631,12 +631,12 @@ impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> {
///
/// It should also be noted that the amount of storage necessary for holding a
/// set of objects is proportional to the maximum of the objects when viewed
/// as a uint.
/// as a `uint`.
#[deriving(Clone)]
pub struct BitvSet {
priv size: uint,

// In theory this is a Bitv instead of always a BigBitv, but knowing that
// In theory this is a `Bitv` instead of always a `BigBitv`, but knowing that
// there's an array of storage makes our lives a whole lot easier when
// performing union/intersection/etc operations
priv bitv: BigBitv
Expand Down Expand Up @@ -861,7 +861,7 @@ impl MutableSet<uint> for BitvSet {
}

impl BitvSet {
/// Visits each of the words that the two bit vectors (self and other)
/// Visits each of the words that the two bit vectors (`self` and `other`)
/// both have in common. The three yielded arguments are (bit location,
/// w1, w2) where the bit location is the number of bits offset so far,
/// and w1/w2 are the words coming from the two vectors self, other.
Expand All @@ -874,13 +874,13 @@ impl BitvSet {
.map(|((i, &w), o_store)| (i * uint::bits, w, o_store[i]))
}

/// Visits each word in self or other that extends beyond the other. This
/// Visits each word in `self` or `other` that extends beyond the other. This
/// will only iterate through one of the vectors, and it only iterates
/// over the portion that doesn't overlap with the other one.
///
/// The yielded arguments are a bool, the bit offset, and a word. The bool
/// is true if the word comes from 'self', and false if it comes from
/// 'other'.
/// The yielded arguments are a `bool`, the bit offset, and a word. The `bool`
/// is true if the word comes from `self`, and `false` if it comes from
/// `other`.
fn outlier_iter<'a>(&'a self, other: &'a BitvSet)
-> Map<'static, ((uint, &'a uint), uint), (bool, uint, uint),
Zip<Enumerate<vec::VecIterator<'a, uint>>, Repeat<uint>>> {
Expand Down

5 comments on commit 3165dde

@bors
Copy link
Contributor

@bors bors commented on 3165dde Sep 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at huonw@3165dde

@bors
Copy link
Contributor

@bors bors commented on 3165dde Sep 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging huonw/rust/kud1ing-docs = 3165dde into auto

@bors
Copy link
Contributor

@bors bors commented on 3165dde Sep 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huonw/rust/kud1ing-docs = 3165dde merged ok, testing candidate = fcd3776

@bors
Copy link
Contributor

@bors bors commented on 3165dde Sep 27, 2013

@bors
Copy link
Contributor

@bors bors commented on 3165dde Sep 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = fcd3776

Please sign in to comment.