func bitsSet(bits uint16) uint {
	c := uint(0)
	for v := bits; v != 0; c++ {
		v &= v - 1
	}
	return c
}
bitsSet counts number of bits set.
Proudly stolen from:
https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
package chaincfg
import (
	"errors"
	"fmt"
	"strings"
)
var (
	ErrDuplicateVoteId  = errors.New("duplicate vote id")
	ErrInvalidMask      = errors.New("invalid mask")
	ErrNotConsecutive   = errors.New("choices not consecutive")
	ErrTooManyChoices   = errors.New("too many choices")
	ErrInvalidAbstain   = errors.New("invalid abstain bits")
	ErrInvalidBits      = errors.New("invalid vote bits")
	ErrInvalidIsAbstain = errors.New("one and only one IsAbstain rule " +
		"violation")
	ErrInvalidIsNo      = errors.New("one and only one IsNo rule violation")
	ErrInvalidBothFlags = errors.New("IsNo and IsAbstain may not be both " +
		"set to true")
	ErrDuplicateChoiceId = errors.New("duplicate choice ID")
)