You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have written these functions for my own use, but I would like it better if they were inside std::bitv:
/**
* 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.
*/
fn from_bytes(bytes: [u8]) -> bitv;
/**
* Transform a [bool] into a bitv by converting each bool into a bit.
*/
fn from_bools(bools: [bool]) -> bitv;
/**
* Create a bitv of the specified length where the value at each
* index is f(index).
*/
fn from_fn(len: uint, f: fn(index: uint) -> bool) -> bitv;
(there are also corresponding to_bytes/to_bools methods).
As a separate but related issue, I think it would be nice if the bitv type was turned into a class and its internal data marked as private members.
As either of these requests pleasing to you? I can provide pull requests (with tests/docs/etc) if they are.
The text was updated successfully, but these errors were encountered:
There's already a bug for the second issue: #2341 - I actually have a patch for this, but it's not working and I haven't gotten around to figuring out why.
Feel free to submit a pull request for the added functions! Thanks!
I have written these functions for my own use, but I would like it better if they were inside std::bitv:
(there are also corresponding to_bytes/to_bools methods).
As a separate but related issue, I think it would be nice if the bitv type was turned into a class and its internal data marked as private members.
As either of these requests pleasing to you? I can provide pull requests (with tests/docs/etc) if they are.
The text was updated successfully, but these errors were encountered: