Files
opencloud/vendor/github.com/klauspost/compress/s2/hashtable_pool.go
dependabot[bot] 7c2cb14a80 build(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.23.2 to 1.24.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.24.1/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.23.2...v1.24.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.24.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-03 11:04:15 +02:00

66 lines
1.7 KiB
Go

package s2
import "sync"
// Table size constants
const (
betterLongTableBits = 17
betterLongTableSize = 1 << betterLongTableBits // 131072
betterShortTableBits = 14
betterShortTableSize = 1 << betterShortTableBits // 16384
betterSnappyLongTableBits = 16
betterSnappyLongTableSize = 1 << betterSnappyLongTableBits // 65536
bestLongTableBits = 19
bestLongTableSize = 1 << bestLongTableBits // 524288
bestShortTableBits = 16
bestShortTableSize = 1 << bestShortTableBits // 65536
)
type betterTables struct {
lTable [betterLongTableSize]uint32
sTable [betterShortTableSize]uint32
}
var betterTablePool = sync.Pool{New: func() any { return &betterTables{} }}
// betterSnappyTables holds better-snappy compression hash tables.
type betterSnappyTables struct {
lTable [betterSnappyLongTableSize]uint32
sTable [betterShortTableSize]uint32
}
var betterSnappyTablePool = sync.Pool{New: func() any { return &betterSnappyTables{} }}
// bestTables holds best compression hash tables.
type bestTables struct {
lTable [bestLongTableSize]uint64
sTable [bestShortTableSize]uint64
}
var bestTablePool = sync.Pool{New: func() any { return &bestTables{} }}
// getBetterTables gets a zeroed betterTables from the pool.
func getBetterTables() *betterTables {
t := betterTablePool.Get().(*betterTables)
*t = betterTables{}
return t
}
// getBetterSnappyTables gets a zeroed betterSnappyTables from the pool.
func getBetterSnappyTables() *betterSnappyTables {
t := betterSnappyTablePool.Get().(*betterSnappyTables)
*t = betterSnappyTables{}
return t
}
// getBestTables gets a zeroed bestTables from the pool.
func getBestTables() *bestTables {
t := bestTablePool.Get().(*bestTables)
*t = bestTables{}
return t
}