// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package set provides simple set data structures for uint64s.
package set import // int64s represents a set of integers within the range of 0..63. type int64s uint64 func ( *int64s) () int { return bits.OnesCount64(uint64(*)) } func ( *int64s) ( uint64) bool { return uint64(*)&(uint64(1)<<) > 0 } func ( *int64s) ( uint64) { *(*uint64)() |= uint64(1) << } func ( *int64s) ( uint64) { *(*uint64)() &^= uint64(1) << } // Ints represents a set of integers within the range of 0..math.MaxUint64. type Ints struct { lo int64s hi map[uint64]struct{} } func ( *Ints) () int { return .lo.Len() + len(.hi) } func ( *Ints) ( uint64) bool { if < 64 { return .lo.Has() } , := .hi[] return } func ( *Ints) ( uint64) { if < 64 { .lo.Set() return } if .hi == nil { .hi = make(map[uint64]struct{}) } .hi[] = struct{}{} } func ( *Ints) ( uint64) { if < 64 { .lo.Clear() return } delete(.hi, ) }