package bit_storage import "encoding/json" type bitU32 struct { V uint32 } var _ BitStorage[uint32] = &bitU32{} func EmptyU32() *bitU32 { return &bitU32{} } func (b *bitU32) Set(v uint32) { b.V |= v } func (b *bitU32) Clear(v uint32) { b.V &^= v } func (b *bitU32) Get(v uint32) bool { return b.V&v > 0 } func (b *bitU32) Unique() []uint32 { z := make([]uint32, 0) m := 0 n := b.V for n > 0 { z = append(z, (n&2)<>= 1 m++ } return z } func (b *bitU32) Dump() []uint32 { return []uint32{b.V} } func (b *bitU32) MarshalJSON() ([]byte, error) { return json.Marshal(b.V) } func (b *bitU32) UnmarshalJSON(bytes []byte) error { return json.Unmarshal(bytes, &b.V) }