github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/bitvec/bv.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package bitvec 6 7 // A BitVec is a bit vector. 8 type BitVec struct { 9 N int32 10 B []uint32 11 } 12 13 func New(n int32) BitVec 14 15 type Bulk struct { 16 words []uint32 17 nbit int32 18 nword int32 19 } 20 21 func NewBulk(nbit int32, count int32) Bulk 22 23 func (b *Bulk) Next() BitVec 24 25 func (bv1 BitVec) Eq(bv2 BitVec) bool 26 27 func (dst BitVec) Copy(src BitVec) 28 29 func (bv BitVec) Get(i int32) bool 30 31 func (bv BitVec) Set(i int32) 32 33 func (bv BitVec) Unset(i int32) 34 35 // bvnext returns the smallest index >= i for which bvget(bv, i) == 1. 36 // If there is no such index, bvnext returns -1. 37 func (bv BitVec) Next(i int32) int32 38 39 func (bv BitVec) IsEmpty() bool 40 41 func (bv BitVec) Count() int 42 43 func (bv BitVec) Not() 44 45 // union 46 func (dst BitVec) Or(src1, src2 BitVec) 47 48 // intersection 49 func (dst BitVec) And(src1, src2 BitVec) 50 51 // difference 52 func (dst BitVec) AndNot(src1, src2 BitVec) 53 54 func (bv BitVec) String() string 55 56 func (bv BitVec) Clear()