Skip to content

Commit

Permalink
Merge pull request #92 from paralin/add-from-with-len
Browse files Browse the repository at this point in the history
bitset: add from with length func
  • Loading branch information
lemire authored Mar 4, 2022
2 parents dfa3e34 + d10d8d6 commit 04f5e3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bitset.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ func (b *BitSet) safeSet() []uint64 {

// From is a constructor used to create a BitSet from an array of integers
func From(buf []uint64) *BitSet {
return &BitSet{uint(len(buf)) * 64, buf}
return FromWithLength(uint(len(buf))*64, buf)
}

// FromWithLength constructs from an array of integers and length.
func FromWithLength(len uint, set []uint64) *BitSet {
return &BitSet{len, set}
}

// Bytes returns the bitset as array of integers
Expand Down

0 comments on commit 04f5e3f

Please sign in to comment.