RLEdecodebytes takes a run-length encoded byte slice and returns the original byte slice
(data []byte)
| 65 | |
| 66 | // RLEdecodebytes takes a run-length encoded byte slice and returns the original byte slice |
| 67 | func RLEdecodebytes(data []byte) []byte { |
| 68 | var result []byte |
| 69 | |
| 70 | for i := 0; i < len(data); i += 2 { |
| 71 | count := int(data[i]) |
| 72 | result = append(result, bytes.Repeat([]byte{data[i+1]}, count)...) |
| 73 | } |
| 74 | |
| 75 | return result |
| 76 | } |
no outgoing calls