@@ -122,10 +122,13 @@ e.length += len len -= added // Not enough bits to write if e.length < 8 { + // Account for the processed input byte + total++ + continue } // Clearing e.length is not necessary as it will be overwritten later @@ -148,11 +151,11 @@ // Abort write on error if err != nil { break } - // Account for the just-written byte + // Account for the processed input byte total++ // Clear the buffer e.buffer = e.buffer[:0] }