In Go is it possible to define a custom type with a number of bits other than those offered by byte uint uint16
or any of the other built-in types?
I'm planning on using "just enough bits" to represent variables and wanted a 6-bit and a 4-bit type. Perhaps a composite bool type?
type fourbit struct{
ones bool
twos bool
fours bool
eights bool
}
Though this sort of thing is quite messy and it would be nice to have a more general solution for n-bit types.