File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,17 @@ This package provides various compression algorithms.
14
14
[ ![ Go] ( https://github.com/klauspost/compress/actions/workflows/go.yml/badge.svg )] ( https://github.com/klauspost/compress/actions/workflows/go.yml )
15
15
[ ![ Sourcegraph Badge] ( https://sourcegraph.com/github.com/klauspost/compress/-/badge.svg )] ( https://sourcegraph.com/github.com/klauspost/compress?badge )
16
16
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
+
17
28
# changelog
18
29
19
30
* Sep 23rd, 2024 - [ 1.17.10] ( https://github.com/klauspost/compress/releases/tag/v1.17.10 )
Original file line number Diff line number Diff line change 4
4
"io"
5
5
"math"
6
6
"sync"
7
+
8
+ "github.com/klauspost/compress/internal/le"
7
9
)
8
10
9
11
const (
@@ -152,18 +154,11 @@ func hashSL(u uint32) uint32 {
152
154
}
153
155
154
156
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 )
159
158
}
160
159
161
160
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 )
167
162
}
168
163
169
164
func statelessEnc (dst * tokens , src []byte , startAt int16 ) {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ A high performance compression algorithm is implemented. For now focused on spee
6
6
7
7
This package provides [ compression] ( #Compressor ) to and [ decompression] ( #Decompressor ) of Zstandard content.
8
8
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.
10
10
11
11
The ` zstd ` package is provided as open source software using a Go standard license.
12
12
You can’t perform that action at this time.
0 commit comments