Module mayda::utility [] [src]

Contains constants, enums, traits and functions used by all of the encoding types provided by the mayda crate.

Traits

Access

A trait for indexing an encoded vector. Similar to but less convenient than Index. Index::index() returns a reference, but an encoded vector type must give ownership of the returned value to the caller.

AccessInto

A trait for indexing a range of an encoded vector. Writes the result into the slice provided. Similar to but less convenient than Index.

Bits

Indicates that the bitwise representation of the type is known to mayda. Intended to be implemented only for the primitive integer types. Mainly used as a bound on the Encode trait.

Encode

Indicates that the type can be encoded and decoded by mayda.

Functions

select_m

A modified version of the Floyd-Rivest algorithm with fewer comparisions and fewer swaps, specialized for the case of slices with length < 500. The modifications may not be known in the literature. Intended to be used to find the median of a block.

words_for_bits

Returns number of words required to store the given number of bits. A word is 32 bits long.