diff options
Diffstat (limited to 'lib/libpbm2.c')
-rw-r--r-- | lib/libpbm2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libpbm2.c b/lib/libpbm2.c index e12b1e33..503fd6c9 100644 --- a/lib/libpbm2.c +++ b/lib/libpbm2.c @@ -268,15 +268,16 @@ pbm_cleanrowend_packed(unsigned char * const packedBits, /*---------------------------------------------------------------------------- Set fractional "don't care" bits at end of row to zero. ----------------------------------------------------------------------------*/ - unsigned int const last = pbm_packed_bytes(cols) - 1; unsigned int const bitsPerChar = 8; - assert(cols > 0); - if (cols % bitsPerChar > 0) { - packedBits[last] >>= bitsPerChar - cols % bitsPerChar; - packedBits[last] <<= bitsPerChar - cols % bitsPerChar; - } + unsigned int const last = pbm_packed_bytes(cols) - 1; + + assert(pbm_packed_bytes(cols) > 0); + + packedBits[last] >>= bitsPerChar - cols % bitsPerChar; + packedBits[last] <<= bitsPerChar - cols % bitsPerChar; + } } |