func (s MaskSet) DiscardRegister(r Register) bool {
	return s.Discard(r.ID(), r.Mask())
}
DiscardRegister is a convenience for discarding the register's (ID, mask) from the set.
Reports whether this made any change to the set.
package reg
type MaskSet map[ID]uint16
func NewEmptyMaskSet() MaskSet {
	return MaskSet{}
}
func NewMaskSetFromRegisters(rs []Register) MaskSet {
	s := NewEmptyMaskSet()
	for _, r := range rs {
		s.AddRegister(r)
	}
	return s
}
func (s MaskSet) Clone() MaskSet {
	c := NewEmptyMaskSet()
	for id, mask := range s {
		c.Add(id, mask)
	}
	return c
}
func (s MaskSet) Add(id ID, mask uint16) bool {
	if (s[id] & mask) == mask {
		return false
	}
	s[id] |= mask
	return true
}
func (s MaskSet) AddRegister(r Register) bool {
	return s.Add(r.ID(), r.Mask())
}
func (s MaskSet) Discard(id ID, mask uint16) bool {
	if curr, found := s[id]; !found || (curr&mask) == 0 {
		return false
	}
	s[id] &^= mask
	if s[id] == 0 {
		delete(s, id)
	}
	return true
}