github.com/parquet-go/parquet-go@v0.21.1-0.20240501160520-b3c3a0c3ed6f/level.go (about) 1 package parquet 2 3 import "github.com/parquet-go/parquet-go/internal/bytealg" 4 5 func countLevelsEqual(levels []byte, value byte) int { 6 return bytealg.Count(levels, value) 7 } 8 9 func countLevelsNotEqual(levels []byte, value byte) int { 10 return len(levels) - countLevelsEqual(levels, value) 11 } 12 13 func appendLevel(levels []byte, value byte, count int) []byte { 14 i := len(levels) 15 n := len(levels) + count 16 17 if cap(levels) < n { 18 newLevels := make([]byte, n, 2*n) 19 copy(newLevels, levels) 20 levels = newLevels 21 } else { 22 levels = levels[:n] 23 } 24 25 bytealg.Broadcast(levels[i:], value) 26 return levels 27 }