Made changes based in reference implementation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-02-26 15:59:04 +01:00
parent 01ef1ed311
commit 5d5f2413bf

10
fifo.go
View file

@ -106,13 +106,13 @@ func (s *fifo) getValue(ad *adapter) (value int32) {
s.bcount--
var level, k, tmp uint32
if value != 0 {
if value == 0 {
level = 0
k = ad.k0
} else {
level = 1
k = ad.k1
value--
} else {
level = 0
k = ad.k0
}
if k != 0 {
for s.bcount < k {
@ -125,7 +125,7 @@ func (s *fifo) getValue(ad *adapter) (value int32) {
s.bcount -= k
s.bcache &= bitMask[s.bcount]
}
if level != 0 {
if level == 1 {
ad.sum1 += uint32(value) - (ad.sum1 >> 4)
if ad.k1 > 0 && ad.sum1 < shift16[ad.k1] {
ad.k1--