mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
Move util::vec::byte_swap to canvas_traits
This commit is contained in:
parent
a5b524d559
commit
e77efb93c1
7 changed files with 19 additions and 25 deletions
|
@ -539,3 +539,16 @@ impl ToAzColor for RGBA {
|
|||
self.alpha as AzFloat)
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue