package bin

import 

// Fields represent a bitfield value that compactly encodes
// information about provided conditional fields, e.g. says
// that fields "1", "5" and "10" were set.
type Fields uint32

// Zero returns true, if all bits are equal to zero.
func ( Fields) () bool {
	return  == 0
}

// String implement fmt.Stringer
func ( Fields) () string {
	return strconv.FormatUint(uint64(), 2)
}

// Decode implements Decoder.
func ( *Fields) ( *Buffer) error {
	,  := .Int32()
	if  != nil {
		return 
	}
	* = Fields()
	return nil
}

// Encode implements Encoder.
func ( Fields) ( *Buffer) error {
	.PutUint32(uint32())
	return nil
}

// Has reports whether field with index n was set.
func ( Fields) ( int) bool {
	return &(1<<) != 0
}

// Unset unsets field with index n.
func ( *Fields) ( int) {
	* &= ^(1 << )
}

// Set sets field with index n.
func ( *Fields) ( int) {
	* |= 1 << 
}