Skip to content

Commit 209574e

Browse files
committed
Update docs
1 parent b959ae3 commit 209574e

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ This package provides various compression algorithms.
1414
[![Go](https://github.com/klauspost/compress/actions/workflows/go.yml/badge.svg)](https://github.com/klauspost/compress/actions/workflows/go.yml)
1515
[![Sourcegraph Badge](https://sourcegraph.com/github.com/klauspost/compress/-/badge.svg)](https://sourcegraph.com/github.com/klauspost/compress?badge)
1616

17+
# package usage
18+
19+
Use `go get github.com/klauspost/compress@latest` to add it to your project.
20+
21+
This package will support the current Go version and 2 versions back.
22+
23+
* Use the `nounsafe` tag to disable all use of the "unsafe" package.
24+
* Use the `noasm` tag to disable all assembly across packages.
25+
26+
Use the links above for more information on each.
27+
1728
# changelog
1829

1930
* Sep 23rd, 2024 - [1.17.10](https://github.com/klauspost/compress/releases/tag/v1.17.10)

flate/stateless.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"io"
55
"math"
66
"sync"
7+
8+
"github.com/klauspost/compress/internal/le"
79
)
810

911
const (
@@ -152,18 +154,11 @@ func hashSL(u uint32) uint32 {
152154
}
153155

154156
func load3216(b []byte, i int16) uint32 {
155-
// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
156-
b = b[i:]
157-
b = b[:4]
158-
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
157+
return le.Load32(b, i)
159158
}
160159

161160
func load6416(b []byte, i int16) uint64 {
162-
// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
163-
b = b[i:]
164-
b = b[:8]
165-
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
166-
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
161+
return le.Load64(b, i)
167162
}
168163

169164
func statelessEnc(dst *tokens, src []byte, startAt int16) {

zstd/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A high performance compression algorithm is implemented. For now focused on spee
66

77
This package provides [compression](#Compressor) to and [decompression](#Decompressor) of Zstandard content.
88

9-
This package is pure Go and without use of "unsafe".
9+
This package is pure Go. Use `noasm` and `nounsafe` to disable relevant features.
1010

1111
The `zstd` package is provided as open source software using a Go standard license.
1212

0 commit comments

Comments
 (0)