MCPcopy Create free account

hub / github.com/bits-and-blooms/bitset / functions

Functions342 in github.com/bits-and-blooms/bitset

↓ 151 callersFunctionNew
New creates a new BitSet with a hint that length bits will be required. The memory usage is at least length/8 bytes. In case of allocation failure, th
bitset.go:166
↓ 126 callersMethodSet
Set bit i to 1, the capacity of the bitset is automatically increased accordingly. Warning: using a very large value for 'i' may lead to a memory shor
bitset.go:275
↓ 46 callersMethodCount
Count (number of set bits). Also known as "popcount" or "population count".
bitset.go:924
↓ 37 callersMethodTest
Test whether bit i is set.
bitset.go:242
↓ 32 callersMethodLen
Len returns the number of bits in the BitSet. Note that it differs from the Count function.
bitset.go:208
↓ 27 callersMethodEqual
Equal tests the equivalence of two BitSets. False if they are of different sizes, otherwise true only if all the same bits are set
bitset.go:934
↓ 25 callersFunctionFrom
From is a constructor used to create a BitSet from an array of words
bitset.go:110
↓ 22 callersMethodString
String creates a string representation of the BitSet. It is only intended for human-readable output and not for serialization.
bitset.go:516
↓ 21 callersFunctionpanicIfNull
(b *BitSet)
bitset.go:959
↓ 19 callersMethodNextSet
NextSet returns the next bit set from the specified index, including possibly the current index along with an error code (true = valid, false = no set
bitset.go:642
↓ 17 callersFunctionwordsIndex
wordsIndex calculates the index of words in a `uint64`
bitset.go:158
↓ 12 callersMethodClear
Clear bit i to 0. This never causes a memory allocation. It is always safe.
bitset.go:284
↓ 11 callersMethodwordCount
wordCount returns the number of words used in a bit set
bitset.go:866
↓ 11 callersFunctionwordsNeeded
wordsNeeded calculates the number of words needed for i bits
bitset.go:144
↓ 10 callersFunctionCap
Cap returns the total possible capacity, or number of bits that can be stored in the BitSet theoretically. Under 32-bit system, it is 4294967295 and u
bitset.go:202
↓ 10 callersMethodClone
Clone this BitSet, returning a new BitSet that has the same bits set. In case of allocation failure, the function will return an empty BitSet.
bitset.go:872
↓ 8 callersMethodBytes
Bytes returns the bitset as array of 64-bit words, giving direct access to the internal representation. It is not a copy, so changes to the returned s
bitset.go:132
↓ 8 callersMethodDumpAsBits
DumpAsBits dumps a bit set as a string of bits. Following the usual convention in Go, the least significant bits are printed last (index 0 is at the e
bitset.go:1275
↓ 8 callersMethodNextSetMany
NextSetMany returns many next bit sets from the specified index, including possibly the current index and up to cap(buffer). If the returned slice has
bitset.go:690
↓ 8 callersMethodextendSet
extendSet adds additional words to incorporate new bits if needed
bitset.go:213
↓ 8 callersFunctionpopcntSlice
(s []uint64)
popcnt.go:5
↓ 7 callersMethodReadFrom
ReadFrom reads a BitSet from a stream written using WriteTo The format is: 1. uint64 length 2. []uint64 set See WriteTo for details. Upon success, the
bitset.go:1389
↓ 7 callersMethodSetAll
SetAll sets the entire BitSet
bitset.go:854
↓ 6 callersMethodClearAll
ClearAll clears the entire BitSet. It does not free the memory.
bitset.go:844
↓ 6 callersMethodCopyFull
CopyFull copies into a destination BitSet such that the destination is identical to the source after the operation, allocating memory if necessary.
bitset.go:903
↓ 6 callersMethodDeleteAt
DeleteAt deletes the bit at the given index position from within the bitset All the bits residing on the left of the deleted bit get shifted right by
bitset.go:546
↓ 6 callersMethodDepositTo
DepositTo spreads bits from a compacted form in the BitSet into positions specified by mask in dst. This is the inverse operation of Extract. For exa
bitset.go:1767
↓ 6 callersMethodIntersection
Intersection of base set and other set This is the BitSet equivalent of & (and) In case of allocation failure, the function will return an empty BitSe
bitset.go:1032
↓ 6 callersMethodSetTo
SetTo sets bit i to value. Warning: using a very large value for 'i' may lead to a memory shortage and a panic: the caller is responsible for providin
bitset.go:296
↓ 6 callersMethodWrite
(p []byte)
bitset_test.go:3521
↓ 6 callersMethodWriteTo
WriteTo writes a BitSet to a stream. The format is: 1. uint64 length 2. []uint64 set The length is the number of bits in the BitSet. The set is a sli
bitset.go:1354
↓ 6 callersFunctionsortByLength
Convenience function: return two bitsets ordered by increasing length. Note: neither can be nil
bitset.go:1020
↓ 5 callersMethodDifference
Difference of base set and other set This is the BitSet equivalent of &^ (and not)
bitset.go:967
↓ 5 callersMethodDifferenceCardinality
DifferenceCardinality computes the cardinality of the difference
bitset.go:982
↓ 5 callersMethodEachSet
EachSet returns an iterator over the indices of all set bits in ascending order, for use with Go 1.23+ range-over-function loops: for i := range b.E
bitset_iter.go:19
↓ 5 callersMethodExtractTo
ExtractTo copies bits from the BitSet using positions specified in mask into a compacted form in dst. The number of set bits in mask determines the nu
bitset.go:1708
↓ 5 callersMethodFlipRange
FlipRange bit in [start, end). Warning: using a very large value for 'end' may lead to a memory shortage and a panic: the caller is responsible for pr
bitset.go:361
↓ 5 callersMethodIntersectionCardinality
IntersectionCardinality computes the cardinality of the intersection
bitset.go:1044
↓ 5 callersMethodNextClear
NextClear returns the next clear bit from the specified index, including possibly the current index along with an error code (true = valid, false = no
bitset.go:742
↓ 5 callersMethodPreviousClear
PreviousClear returns the previous clear bit from the specified index, including possibly the current index along with an error code (true = valid, fa
bitset.go:812
↓ 5 callersMethodPreviousSet
PreviousSet returns the previous set bit from the specified index, including possibly the current index along with an error code (true = valid, false
bitset.go:781
↓ 5 callersMethodRank
Rank returns the number of set bits up to and including the index that are set in the bitset. See https://en.wikipedia.org/wiki/Ranking#Ranking_in_sta
bitset.go:1483
↓ 5 callersMethodSelect
Select returns the index of the jth set bit, where j is the argument. The caller is responsible to ensure that 0 <= j < Count(): when j is out of rang
bitset.go:1520
↓ 5 callersMethodShiftRight
ShiftRight shifts the bitset like >> operation would do.
bitset.go:1604
↓ 5 callersMethodSymmetricDifference
SymmetricDifference of base set and other set This is the BitSet equivalent of ^ (xor)
bitset.go:1147
↓ 5 callersMethodUnion
Union of base set and other set This is the BitSet equivalent of | (or)
bitset.go:1089
↓ 4 callersMethodAll
All returns true if all bits are set, false otherwise. Returns true for empty sets.
bitset.go:1228
↓ 4 callersMethodBinaryStorageSize
BinaryStorageSize returns the binary storage requirements (see WriteTo) in bytes.
bitset.go:1288
↓ 4 callersMethodCompact
Compact shrinks BitSet to so that we preserve all set bits, while minimizing memory usage. Compact calls Shrink. A new slice is allocated to store the
bitset.go:458
↓ 4 callersMethodCopy
Copy into a destination BitSet using the Go array copy semantics: the number of bits copied is the minimum of the number of bits in the current BitSet
bitset.go:884
↓ 4 callersMethodFlip
Flip bit at i. Warning: using a very large value for 'i' may lead to a memory shortage and a panic: the caller is responsible for providing sensible p
bitset.go:349
↓ 4 callersMethodIsSuperSet
IsSuperSet returns true if this is a superset of the other set
bitset.go:1254
↓ 4 callersMethodNone
None returns true if no bit is set, false otherwise. Returns true for empty sets.
bitset.go:1235
↓ 4 callersMethodShiftLeft
ShiftLeft shifts the bitset like << operation would do. Left shift may require bitset size extension. We try to avoid the unnecessary memory operatio
bitset.go:1548
↓ 4 callersMethodShrink
Shrink shrinks BitSet so that the provided value is the last possible set value. It clears all bits > the provided index and reduces the size and leng
bitset.go:431
↓ 4 callersMethodSymmetricDifferenceCardinality
SymmetricDifferenceCardinality computes the cardinality of the symmetric difference
bitset.go:1160
↓ 4 callersMethodUnionCardinality
UnionCardinality computes the cardinality of the union of the base set and the compare set.
bitset.go:1102
↓ 4 callersMethodcleanLastWord
Clean last word by setting unused bits to 0
bitset.go:1208
↓ 4 callersFunctiongood
function provided by FlorianUekermann
bitset_benchmark_test.go:330
↓ 4 callersFunctionpext
go:generate go run cmd/pextgen/main.go -pkg=bitset
bitset.go:1813
↓ 3 callersMethodAppendTo
AppendTo appends all set bits to buf and returns the (maybe extended) buf. In case of allocation failure, the function will panic. See also [BitSet.A
bitset.go:595
↓ 3 callersMethodAsSlice
AsSlice returns all set bits as slice. It panics if the capacity of buf is < b.Count() See also [BitSet.AppendTo] and [BitSet.NextSetMany].
bitset.go:615
↓ 3 callersMethodComplement
Complement computes the (local) complement of a bitset (up to length bits) In case of allocation failure, the function will return an empty BitSet.
bitset.go:1216
↓ 3 callersFunctionFromWithLength
FromWithLength constructs from an array of words and length in bits. This function is for advanced users, most users should prefer the From function.
bitset.go:120
↓ 3 callersMethodInPlaceDifference
InPlaceDifference computes the difference of base set and other set This is the BitSet equivalent of &^ (and not)
bitset.go:999
↓ 3 callersMethodInPlaceIntersection
InPlaceIntersection destructively computes the intersection of base set and the compare set. This is the BitSet equivalent of & (and)
bitset.go:1058
↓ 3 callersMethodInPlaceUnion
InPlaceUnion creates the destructive union of base set and compare set. This is the BitSet equivalent of | (or).
bitset.go:1118
↓ 3 callersMethodInsertAt
InsertAt takes an index which indicates where a bit should be inserted. Then it shifts all the bits in the set to the left by 1, starting from the giv
bitset.go:480
↓ 3 callersMethodMarshalBinary
MarshalBinary encodes a BitSet into a binary form and returns the result. Please see WriteTo for details.
bitset.go:1431
↓ 3 callersMethodUnmarshalBinary
UnmarshalBinary decodes the binary form generated by MarshalBinary. Please see WriteTo for details.
bitset.go:1443
↓ 3 callersFunctionpdep
(w, m uint64)
bitset.go:1832
↓ 3 callersFunctionpdepByte
pdepByte handles single-byte PDEP operation
cmd/pextgen/main.go:27
↓ 3 callersFunctionpextByte
pextByte handles single-byte PEXT operation
cmd/pextgen/main.go:13
↓ 3 callersFunctionsetRnd
(bits []uint64, halfings int)
bitset_benchmark_test.go:281
↓ 2 callersMethodAny
Any returns true if any bit is set, false otherwise
bitset.go:1248
↓ 2 callersMethodGetWord64AtBit
GetWord64AtBit retrieves bits i through i+63 as a single uint64 value
bitset.go:250
↓ 2 callersMethodInPlaceSymmetricDifference
InPlaceSymmetricDifference creates the destructive SymmetricDifference of base set and other set This is the BitSet equivalent of ^ (xor)
bitset.go:1176
↓ 2 callersMethodIsStrictSuperSet
IsStrictSuperSet returns true if this is a strict superset of the other set
bitset.go:1268
↓ 2 callersFunctionLittleEndian
LittleEndian sets Marshal/Unmarshal Binary as Little Endian (Default: binary.BigEndian)
bitset.go:77
↓ 2 callersFunctionMustNew
MustNew creates a new BitSet with the given length bits. It panics if length exceeds the possible capacity or by a lack of memory.
bitset.go:186
↓ 2 callersMethodOnesBetween
OnesBetween returns the number of set bits in the range [from, to). The range is inclusive of 'from' and exclusive of 'to'. Returns 0 if from >= to.
bitset.go:1647
↓ 2 callersMethodSetRange
SetRange sets bits in [start, end) to 1, the capacity of the bitset is automatically increased accordingly. Warning: using a very large value for 'end
bitset.go:308
↓ 2 callersMethodUnmarshalJSON
UnmarshalJSON unmarshals a BitSet from JSON created using MarshalJSON
bitset.go:1462
↓ 2 callersFunctioncopyBinary
(t *testing.T, from encoding.BinaryMarshaler, to encoding.BinaryUnmarshaler)
bitset_test.go:1729
↓ 2 callersFunctiongeneratePextTestCases
(n int)
bitset_test.go:2942
↓ 2 callersFunctiongenerateTable
(name string, data interface{}, comment string)
cmd/pextgen/main.go:40
↓ 2 callersFunctionmain
()
cmd/pextgen/main.go:80
↓ 2 callersFunctionpopcntAndSlice
popcntAndSlice computes the population count of the AND of two slices. It assumes that len(m) >= len(s) > 0.
popcnt.go:48
↓ 2 callersFunctionpopcntMaskSlice
(s, m []uint64)
popcnt.go:25
↓ 2 callersFunctionpopcntOrSlice
popcntOrSlice computes the population count of the OR of two slices. It assumes that len(m) >= len(s) > 0.
popcnt.go:59
↓ 2 callersFunctionpopcntXorSlice
popcntXorSlice computes the population count of the XOR of two slices. It assumes that len(m) >= len(s) > 0.
popcnt.go:70
↓ 2 callersFunctionsetArgs
setArgs replaces the process arguments and resets the flag set so that main() can be invoked more than once.
cmd/pextgen/main_test.go:91
↓ 2 callersMethodtop
top detects the top bit set
bitset.go:1533
↓ 2 callersFunctionwordsNeededUnbound
wordsNeededUnbound calculates the number of words needed for i bits, possibly exceeding the capacity. This function is useful if you know that the cap
bitset.go:153
↓ 1 callersFunctionBase64StdEncoding
Base64StdEncoding Marshal/Unmarshal BitSet with base64.StdEncoding(Default: base64.URLEncoding)
bitset.go:74
↓ 1 callersFunctionBigEndian
BigEndian sets Marshal/Unmarshal Binary as Big Endian (Default: binary.BigEndian)
bitset.go:80
↓ 1 callersFunctionBinaryOrder
BinaryOrder returns the current binary order, see also LittleEndian() and BigEndian() to change the order.
bitset.go:84
↓ 1 callersMethodDeposit
Deposit creates a new BitSet and deposits bits according to a mask. See DepositTo for details.
bitset.go:1755
↓ 1 callersMethodExtract
Extract extracts bits according to a mask and returns the result in a new BitSet. See ExtractTo for details.
bitset.go:1695
↓ 1 callersMethodMarshalJSON
MarshalJSON marshals a BitSet as a JSON structure
bitset.go:1450
next →1–100 of 342, ranked by callers