0

Update dependencies

This commit is contained in:
eleksir
2025-10-12 13:55:23 +03:00
parent 897a2035d9
commit 3ad60b9c69
437 changed files with 26255 additions and 43246 deletions

View File

@@ -6,11 +6,10 @@
package huff0
import (
"encoding/binary"
"errors"
"fmt"
"io"
"github.com/klauspost/compress/internal/le"
)
// bitReader reads a bitstream in reverse.
@@ -47,7 +46,7 @@ func (b *bitReaderBytes) init(in []byte) error {
return nil
}
// peekByteFast requires that at least one byte is requested every time.
// peekBitsFast requires that at least one bit is requested every time.
// There are no checks if the buffer is filled.
func (b *bitReaderBytes) peekByteFast() uint8 {
got := uint8(b.value >> 56)
@@ -67,7 +66,8 @@ func (b *bitReaderBytes) fillFast() {
}
// 2 bounds checks.
low := le.Load32(b.in, b.off-4)
v := b.in[b.off-4 : b.off]
low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24)
b.value |= uint64(low) << (b.bitsRead - 32)
b.bitsRead -= 32
b.off -= 4
@@ -76,7 +76,7 @@ func (b *bitReaderBytes) fillFast() {
// fillFastStart() assumes the bitReaderBytes is empty and there is at least 8 bytes to read.
func (b *bitReaderBytes) fillFastStart() {
// Do single re-slice to avoid bounds checks.
b.value = le.Load64(b.in, b.off-8)
b.value = binary.LittleEndian.Uint64(b.in[b.off-8:])
b.bitsRead = 0
b.off -= 8
}
@@ -86,8 +86,9 @@ func (b *bitReaderBytes) fill() {
if b.bitsRead < 32 {
return
}
if b.off >= 4 {
low := le.Load32(b.in, b.off-4)
if b.off > 4 {
v := b.in[b.off-4 : b.off]
low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24)
b.value |= uint64(low) << (b.bitsRead - 32)
b.bitsRead -= 32
b.off -= 4
@@ -174,7 +175,9 @@ func (b *bitReaderShifted) fillFast() {
return
}
low := le.Load32(b.in, b.off-4)
// 2 bounds checks.
v := b.in[b.off-4 : b.off]
low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24)
b.value |= uint64(low) << ((b.bitsRead - 32) & 63)
b.bitsRead -= 32
b.off -= 4
@@ -182,7 +185,8 @@ func (b *bitReaderShifted) fillFast() {
// fillFastStart() assumes the bitReaderShifted is empty and there is at least 8 bytes to read.
func (b *bitReaderShifted) fillFastStart() {
b.value = le.Load64(b.in, b.off-8)
// Do single re-slice to avoid bounds checks.
b.value = binary.LittleEndian.Uint64(b.in[b.off-8:])
b.bitsRead = 0
b.off -= 8
}
@@ -193,7 +197,8 @@ func (b *bitReaderShifted) fill() {
return
}
if b.off > 4 {
low := le.Load32(b.in, b.off-4)
v := b.in[b.off-4 : b.off]
low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24)
b.value |= uint64(low) << ((b.bitsRead - 32) & 63)
b.bitsRead -= 32
b.off -= 4