Skip to content

Commit b5159db

Browse files
Shnatselkornelski
authored andcommitted
appease cargo fmt
1 parent 577d02f commit b5159db

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lossless_transform.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,12 @@ pub(crate) fn apply_color_indexing_transform(
387387
table_data: &[u8],
388388
) {
389389
if table_size > 16 {
390-
// convert the table of colors into a Vec of color values that can be directly indexed, and that the compiler knows are always 4 bytes in size
391-
let mut table: Vec<[u8; 4]> = table_data.chunks_exact(4).map(|c| TryInto::<[u8; 4]>::try_into(c).unwrap()).collect();
390+
// convert the table of colors into a Vec of color values that can be directly indexed
391+
let mut table: Vec<[u8; 4]> = table_data
392+
.chunks_exact(4)
393+
// convince the compiler that each chunk is 4 bytes long, important for optimizations in the loop below
394+
.map(|c| TryInto::<[u8; 4]>::try_into(c).unwrap())
395+
.collect();
392396
// pad the table to 256 values if it's smaller than that so we could index into it by u8 without bounds checks
393397
table.resize(256, [0; 4]);
394398
// convince the compiler that the length of the table is 256 to avoid bounds checks in the loop below

0 commit comments

Comments
 (0)