vendor: Update golang.org/cznic/...
This commit is contained in:
6
vendor/github.com/cznic/zappy/decode_cgo.go
generated
vendored
6
vendor/github.com/cznic/zappy/decode_cgo.go
generated
vendored
@@ -10,6 +10,10 @@
|
||||
|
||||
package zappy
|
||||
|
||||
import (
|
||||
"github.com/cznic/internal/buffer"
|
||||
)
|
||||
|
||||
/*
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -109,7 +113,7 @@ func Decode(buf, src []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
if len(buf) < dLen {
|
||||
buf = make([]byte, dLen)
|
||||
buf = *buffer.Get(dLen)
|
||||
}
|
||||
|
||||
d := int(C.decode(C.int(s), C.int(len(src)), (*C.uint8_t)(&src[0]), C.int(len(buf)), (*C.uint8_t)(&buf[0])))
|
||||
|
||||
4
vendor/github.com/cznic/zappy/decode_nocgo.go
generated
vendored
4
vendor/github.com/cznic/zappy/decode_nocgo.go
generated
vendored
@@ -12,6 +12,8 @@ package zappy
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/cznic/internal/buffer"
|
||||
)
|
||||
|
||||
func puregoDecode() bool { return true }
|
||||
@@ -35,7 +37,7 @@ func Decode(buf, src []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
if len(buf) < dLen {
|
||||
buf = make([]byte, dLen)
|
||||
buf = *buffer.Get(dLen)
|
||||
}
|
||||
|
||||
var d, offset, length int
|
||||
|
||||
2
vendor/github.com/cznic/zappy/encode.go
generated
vendored
2
vendor/github.com/cznic/zappy/encode.go
generated
vendored
@@ -33,5 +33,5 @@ func emitLiteral(dst, lit []byte) (n int) {
|
||||
// MaxEncodedLen returns the maximum length of a zappy block, given its
|
||||
// uncompressed length.
|
||||
func MaxEncodedLen(srcLen int) int {
|
||||
return 10 + srcLen
|
||||
return 10 + srcLen + (srcLen+1)/2
|
||||
}
|
||||
|
||||
4
vendor/github.com/cznic/zappy/encode_cgo.go
generated
vendored
4
vendor/github.com/cznic/zappy/encode_cgo.go
generated
vendored
@@ -107,6 +107,8 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/cznic/internal/buffer"
|
||||
)
|
||||
|
||||
func puregoEncode() bool { return false }
|
||||
@@ -117,7 +119,7 @@ func puregoEncode() bool { return false }
|
||||
// It is valid to pass a nil buf.
|
||||
func Encode(buf, src []byte) ([]byte, error) {
|
||||
if n := MaxEncodedLen(len(src)); len(buf) < n {
|
||||
buf = make([]byte, n)
|
||||
buf = *buffer.Get(n)
|
||||
}
|
||||
|
||||
if len(src) > math.MaxInt32 {
|
||||
|
||||
4
vendor/github.com/cznic/zappy/encode_nocgo.go
generated
vendored
4
vendor/github.com/cznic/zappy/encode_nocgo.go
generated
vendored
@@ -14,6 +14,8 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/cznic/internal/buffer"
|
||||
)
|
||||
|
||||
func puregoEncode() bool { return true }
|
||||
@@ -24,7 +26,7 @@ func puregoEncode() bool { return true }
|
||||
// It is valid to pass a nil buf.
|
||||
func Encode(buf, src []byte) ([]byte, error) {
|
||||
if n := MaxEncodedLen(len(src)); len(buf) < n {
|
||||
buf = make([]byte, n)
|
||||
buf = *buffer.Get(n)
|
||||
}
|
||||
|
||||
if len(src) > math.MaxInt32 {
|
||||
|
||||
1
vendor/github.com/cznic/zappy/zappy.go
generated
vendored
1
vendor/github.com/cznic/zappy/zappy.go
generated
vendored
@@ -124,7 +124,6 @@ Old=Go snappy, new=zappy:
|
||||
|
||||
The package builds with CGO_ENABLED=0 as well, but the performance is worse.
|
||||
|
||||
|
||||
$ CGO_ENABLED=0 go test -test.run=NONE -test.bench=. > old.benchcmp
|
||||
$ CGO_ENABLED=1 go test -test.run=NONE -test.bench=. > new.benchcmp
|
||||
$ benchcmp old.benchcmp new.benchcmp
|
||||
|
||||
Reference in New Issue
Block a user