[−][src]Function triple_accel::alloc_str
pub fn alloc_str(len: usize) -> Vec<u8>
This creates a vector with the alignment and padding for u128
values, and
then convert it to a vector of u8
values that is returned.
This is possible because u8 has looser alignment requirements than u128
.
This vector can be easily converted back to u128
or u64
later, for Hamming
distance routines.
The returned vector can be edited by copying u8
values into it.
However, do not do any operation (like push
) that may cause the the vector to be
reallocated.
Arguments
len
- the length of the resulting array of u8 values
Example
let s = alloc_str(10); assert!(s.len() == 10);