mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-20 04:56:37 +00:00
Update dependencies
* Updates netlink/netns * Updates x/sys, arkade and apimachinery Build passes, minor updates. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
50
vendor/github.com/klauspost/compress/zstd/zstd.go
generated
vendored
50
vendor/github.com/klauspost/compress/zstd/zstd.go
generated
vendored
@ -5,6 +5,7 @@ package zstd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"log"
|
||||
"math"
|
||||
@ -14,6 +15,12 @@ import (
|
||||
// enable debug printing
|
||||
const debug = false
|
||||
|
||||
// enable encoding debug printing
|
||||
const debugEncoder = debug
|
||||
|
||||
// enable decoding debug printing
|
||||
const debugDecoder = debug
|
||||
|
||||
// Enable extra assertions.
|
||||
const debugAsserts = debug || false
|
||||
|
||||
@ -32,6 +39,9 @@ const zstdMinMatch = 3
|
||||
// Reset the buffer offset when reaching this.
|
||||
const bufferReset = math.MaxInt32 - MaxWindowSize
|
||||
|
||||
// fcsUnknown is used for unknown frame content size.
|
||||
const fcsUnknown = math.MaxUint64
|
||||
|
||||
var (
|
||||
// ErrReservedBlockType is returned when a reserved block type is found.
|
||||
// Typically this indicates wrong or corrupted input.
|
||||
@ -45,6 +55,10 @@ var (
|
||||
// Typically returned on invalid input.
|
||||
ErrBlockTooSmall = errors.New("block too small")
|
||||
|
||||
// ErrUnexpectedBlockSize is returned when a block has unexpected size.
|
||||
// Typically returned on invalid input.
|
||||
ErrUnexpectedBlockSize = errors.New("unexpected block size")
|
||||
|
||||
// ErrMagicMismatch is returned when a "magic" number isn't what is expected.
|
||||
// Typically this indicates wrong or corrupted input.
|
||||
ErrMagicMismatch = errors.New("invalid input: magic number mismatch")
|
||||
@ -68,6 +82,10 @@ var (
|
||||
// This is only returned if SingleSegment is specified on the frame.
|
||||
ErrFrameSizeExceeded = errors.New("frame size exceeded")
|
||||
|
||||
// ErrFrameSizeMismatch is returned if the stated frame size does not match the expected size.
|
||||
// This is only returned if SingleSegment is specified on the frame.
|
||||
ErrFrameSizeMismatch = errors.New("frame size does not match size on stream")
|
||||
|
||||
// ErrCRCMismatch is returned if CRC mismatches.
|
||||
ErrCRCMismatch = errors.New("CRC check failed")
|
||||
|
||||
@ -81,28 +99,17 @@ var (
|
||||
)
|
||||
|
||||
func println(a ...interface{}) {
|
||||
if debug {
|
||||
if debug || debugDecoder || debugEncoder {
|
||||
log.Println(a...)
|
||||
}
|
||||
}
|
||||
|
||||
func printf(format string, a ...interface{}) {
|
||||
if debug {
|
||||
if debug || debugDecoder || debugEncoder {
|
||||
log.Printf(format, a...)
|
||||
}
|
||||
}
|
||||
|
||||
// matchLenFast does matching, but will not match the last up to 7 bytes.
|
||||
func matchLenFast(a, b []byte) int {
|
||||
endI := len(a) & (math.MaxInt32 - 7)
|
||||
for i := 0; i < endI; i += 8 {
|
||||
if diff := load64(a, i) ^ load64(b, i); diff != 0 {
|
||||
return i + bits.TrailingZeros64(diff)>>3
|
||||
}
|
||||
}
|
||||
return endI
|
||||
}
|
||||
|
||||
// matchLen returns the maximum length.
|
||||
// a must be the shortest of the two.
|
||||
// The function also returns whether all bytes matched.
|
||||
@ -126,26 +133,15 @@ func matchLen(a, b []byte) int {
|
||||
}
|
||||
|
||||
func load3232(b []byte, i int32) uint32 {
|
||||
// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
|
||||
b = b[i:]
|
||||
b = b[:4]
|
||||
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
|
||||
return binary.LittleEndian.Uint32(b[i:])
|
||||
}
|
||||
|
||||
func load6432(b []byte, i int32) uint64 {
|
||||
// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
|
||||
b = b[i:]
|
||||
b = b[:8]
|
||||
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
|
||||
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
|
||||
return binary.LittleEndian.Uint64(b[i:])
|
||||
}
|
||||
|
||||
func load64(b []byte, i int) uint64 {
|
||||
// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
|
||||
b = b[i:]
|
||||
b = b[:8]
|
||||
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
|
||||
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
|
||||
return binary.LittleEndian.Uint64(b[i:])
|
||||
}
|
||||
|
||||
type byter interface {
|
||||
|
Reference in New Issue
Block a user