MCPcopy Create free account
hub / github.com/egonelbre/exp / Less

Method Less

physicscompress2/physics/sorting.go:36–40  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

34func (s *sorterZCount) Len() int { return len(s.order) }
35func (s *sorterZCount) Swap(i, j int) { s.order[i], s.order[j] = s.order[j], s.order[i] }
36func (s *sorterZCount) Less(i, j int) bool {
37 vi := int64(s.get(s.order[i]))
38 vj := int64(s.get(s.order[j]))
39 return bit.Count(bit.ZEncode(vi)) < bit.Count(bit.ZEncode(vj))
40}
41
42func SortByZCount(items []int, get func(i int) int) {
43 sort.Sort(&sorterZCount{

Callers

nothing calls this directly

Calls 2

CountFunction · 0.92
ZEncodeFunction · 0.92

Tested by

no test coverage detected