Optimize conversion from u64 to bytes
Make use of iterators
Make use of mem::replace() and cmp::min()
Merge pull request #1 from Florob/idiomatic

Make some code more idiomatic