Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/codecs/pnm/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,8 @@ impl SampleWriter<'_> {
}

fn write_pbm_bits<V>(self, samples: &[V], width: u32) -> io::Result<()>
/* Default gives 0 for all primitives. TODO: replace this with `Zeroable` once it hits stable */
where
V: Default + Eq + Copy,
V: num_traits::Zero + Eq + Copy,
{
// The length of an encoded scanline
let line_width = (width - 1) / 8 + 1;
Expand All @@ -606,7 +605,7 @@ impl SampleWriter<'_> {
for i in 0..8 {
// Black pixels are encoded as 1s
if let Some(&v) = byte_bits.get(i) {
if v == V::default() {
if v.is_zero() {
byte |= 1u8 << (7 - i);
}
}
Expand Down
Loading