fix bitsPerBlock calculation bug in NewXXXXPaletteContainerWithData

This commit is contained in:
Tnze
2023-01-02 22:43:43 +08:00
parent e12b2f368d
commit 36bec6e63d
2 changed files with 12 additions and 3 deletions

View File

@ -67,6 +67,16 @@ func calcBitStorageSize(bits, length int) (size int) {
return (length + valuesPerLong - 1) / valuesPerLong
}
// calcBitsPerValue calculate when "longs" number of uint64 stores
// "length" number of value, how many bits are used for each value.
func calcBitsPerValue(length, longs int) (bits int) {
if longs == 0 || length == 0 {
return 0
}
valuePerLong := (length + longs - 1) / longs
return 64 / valuePerLong
}
type newBitStorageErr struct {
ArrlLen int
WantLen int