aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/util/vec.rs')
-rw-r--r--components/util/vec.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/util/vec.rs b/components/util/vec.rs
index 5342d452020..639e1c260da 100644
--- a/components/util/vec.rs
+++ b/components/util/vec.rs
@@ -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;
}
}