Make it possible to build the style_traits crate with a stable compiler.

Testing this on CI to make sure we don’t regress it is blocked on #11806
This commit is contained in:
Simon Sapin 2016-06-21 13:55:50 +02:00
parent b9b289c4be
commit ea73c8efac
20 changed files with 145 additions and 89 deletions

View file

@ -9,10 +9,13 @@ use super::smallvec::VecLike;
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
pub fn byte_swap(data: &mut [u8]) {
let length = data.len();
for i in (0..length).step_by(4) {
// FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
let mut i = 0;
while i < length {
let r = data[i + 2];
data[i + 2] = data[i + 0];
data[i + 0] = r;
i += 4;
}
}