// make sure all the values are contained in the encoder
make sure all the values are contained in the encoder
// make sure all the values are contained in the encoder
func (e Encoder) EncodeStringSlice(values []string) []byte {
	b := &bytes.Buffer{}
	var remain byte
	var offset byte = 1
	for _, val := range values {
		i := 0
		for ; i < len(e[val])-1; i++ {
			var ofs byte = 1
			for k := 0; k < 8; k++ {
				if e[val][i]&ofs == ofs {
					remain |= offset
				}
				if offset == 128 {
					b.WriteByte(remain)
					remain = 0
					offset = 1
				} else {
					offset = offset << 1
				}
				ofs = ofs << 1
			}
		}
		end := 0
		var ofs byte = 128
		for k := 0; k < 8; k++ {
			if e[val][i]&ofs != ofs {
				ofs = ofs >> 1
				continue
			}
			end = 7 - k
			break
		}
		ofs = 1
		for k := 0; k < end; k++ {
			if e[val][i]&ofs == ofs {
				remain |= offset
			}
			if offset == 128 {
				b.WriteByte(remain)
				remain = 0
				offset = 1
			} else {
				offset = offset << 1
			}
			ofs = ofs << 1
		}
	}
	remain |= offset
	b.WriteByte(remain)
	return b.Bytes()
}
func ( e Encoder ) EncodeStringSlice ( values [ ] string ) [ ] byte { b := & bytes . Buffer { } var remain byte var offset byte = 1 for _ , val := range values { i := 0 for ; i < len ( e [ val ] ) - 1 ; i ++ { var ofs byte = 1 for k := 0 ; k < 8 ; k ++ { if e [ val ] [ i ] & ofs == ofs { remain |= offset } if offset == 128 { b . WriteByte ( remain ) remain = 0 offset = 1 } else { offset = offset << 1 } ofs = ofs << 1 } } end := 0 var ofs byte = 128 for k := 0 ; k < 8 ; k ++ { if e [ val ] [ i ] & ofs != ofs { ofs = ofs >> 1 continue } end = 7 - k break } ofs = 1 for k := 0 ; k < end ; k ++ { if e [ val ] [ i ] & ofs == ofs { remain |= offset } if offset == 128 { b . WriteByte ( remain ) remain = 0 offset = 1 } else { offset = offset << 1 } ofs = ofs << 1 } } remain |= offset b . WriteByte ( remain ) return b . Bytes ( ) }
make sure all the values are contained in the encoder
make sure all the values are contained in the encoder