Skip to content

Commit

Permalink
fix: rle
Browse files Browse the repository at this point in the history
  • Loading branch information
owulveryck committed Aug 29, 2023
1 parent 2ed6c17 commit 011e0bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/rle/rle.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ func (rlewriter *RLE) Write(data []byte) (n int, err error) {
defer encodedPool.Put(encoded)

current := data[0]
count := -1
count := 0

for _, datum := range data {
if count < 255 && datum == current {
if count < 254 && datum == current {
count++
} else {
encoded = append(encoded, uint8(count))
encoded = append(encoded, uint8(current))
current = datum
count = 0
count = 1
}
}

Expand Down

0 comments on commit 011e0bf

Please sign in to comment.