将3bit uint编码/解码为紧凑格式(例如字节片)

Having a slice of uint8 but knowing that the uints are all smaller than 8: is there a simple way to en-/decode into a compact type using 3 bits a uint?

Only thing I can come up with is a complicated way of building a byte slice.