More iterative algorithms

- Add RunIterator and decoder from RLE
 - Add BitIterator and BitsFromRuns
 - Add BitsFromSlice
 - Add RunsFromBits

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera
2019-12-07 15:48:19 +01:00
committed by Jakub Sztandera
parent c557aa206f
commit e5b3c4757d
6 changed files with 329 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
package rlepluslazy
type Run struct {
Val bool
Len uint64
}
func (r Run) Valid() bool {
return r.Len != 0
}
type RunIterator interface {
NextRun() (Run, error)
HasNext() bool
}
type RunIterable interface {
RunIterator() (RunIterator, error)
}
type BitIterator interface {
Next() (uint64, error)
HasNext() bool
}