Add a hash function for bitsets.
@@ -6,6 +6,7 @@ use "slcp"
use "sldup"
use "slfill"
use "types"
+use "hashfuncs"
pkg std =
type bitset = struct
@@ -29,6 +30,7 @@ pkg std =
const bsunion : (a : bitset#, b : bitset# -> void)
const bseq : (a : bitset#, b : bitset# -> bool)
const bsissubset : (a : bitset#, b : bitset# -> bool)
+ const bshash : (a : bitset# -> uint32)
type bsiter = struct
idx : size
@@ -153,6 +155,10 @@ const bseq = {a, b
-> true
}
+const bshash = {a
+ -> std.slhash(a.bits)
+}
+
const ensurelen = {bs, len
if bs.bits.len <= len
slzgrow(&bs.bits, len + 1)
