about summary refs log tree commit diff
path: root/editor/pnminvert.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor/pnminvert.c')
-rw-r--r--editor/pnminvert.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/editor/pnminvert.c b/editor/pnminvert.c
index ceb1ef81..4bee8837 100644
--- a/editor/pnminvert.c
+++ b/editor/pnminvert.c
@@ -50,11 +50,8 @@ invertPbm(FILE * const ifP,
         for (colChar = 0; colChar < colChars; ++colChar)
             bitrow[colChar] = ~ bitrow[colChar];
         
-        /* Clean off remainder of fractional last character */
-        if (cols % CHARBITS > 0) {
-            bitrow[colChars-1] >>= CHARBITS - cols % CHARBITS;
-            bitrow[colChars-1] <<= CHARBITS - cols % CHARBITS;
-        }
+        /* Clean off remainder of fractional last character and write */
+        pbm_cleanrowend_packed(bitrow, cols);
         pbm_writepbmrow_packed(ofP, bitrow, cols, 0);
     }
     pbm_freerow_packed(bitrow);