// FromBytes converts an encoded byte slice (from ToBytes) back to a Literal.
// DEV: May add an error and bounds checking.
776317
func FromBytes(bs []byte) Literal {
	// if len(bs) < 2 {
	// 	return nil, errors.Errorf("byte slice too short: %x", bs)
	// }
	switch bs[0] {
	case bID:
		return B(bs[1] > 0)
	case sID:
		return S(string(bs[1:]))
	case f32ID:
		return F32(math.Float32frombits(binary.BigEndian.Uint32(bs[1:])))
	case f64ID:
		return F64(math.Float64frombits(binary.BigEndian.Uint64(bs[1:])))
	case iID:
		return I(binary.BigEndian.Uint64(bs[1:]))
	case i8ID:
		return I8(bs[1])
	case i16ID:
		return I16(binary.BigEndian.Uint16(bs[1:]))
	case i32ID:
		return I32(binary.BigEndian.Uint32(bs[1:]))
	case i64ID:
		return I64(binary.BigEndian.Uint64(bs[1:]))
	case uID:
		return U(binary.BigEndian.Uint64(bs[1:]))
	case u8ID:
		return U8(bs[1])
	case u16ID:
		return U16(binary.BigEndian.Uint16(bs[1:]))
	case u32ID:
		return U32(binary.BigEndian.Uint32(bs[1:]))
	case u64ID:
		return U64(binary.BigEndian.Uint64(bs[1:]))
	default:
		panic("should have covered all literal types in FromBytes switch")
	}
}
1086575
func (s *Image) SetBytes(v []byte) *Image {
	s.Bytes = v
	return s
}
1186744
func DecodeBytes(b []byte, val interface{}) error {
	r := bytes.NewReader(b)
	d := NewDecoder(r)
	return d.Decode(val)
}
877975
func (s *UpdateByQueryService) From(from int) *UpdateByQueryService {
	s.from = &from
	return s
}
996641
func FromUint64(data [8]byte) uint64 {
	ui64 := binary.LittleEndian.Uint64(data[:])
	return ui64
}
995803
func ToBytes(l Literal) []byte {
	switch l := l.(type) {
	case B:
		if l {
			return []byte{bID, 1}
		}
		return []byte{bID, 0}
	case S:
		return append([]byte{sID}, l[:]...)
	case F32:
		ret := make([]byte, 5)
		ret[0] = f32ID
		binary.BigEndian.PutUint32(ret[1:], math.Float32bits(float32(l)))
		return ret
	case F64:
		ret := make([]byte, 9)
		ret[0] = f64ID
		binary.BigEndian.PutUint64(ret[1:], math.Float64bits(float64(l)))
		return ret
	case I:
		ret := make([]byte, 9)
		ret[0] = iID
		binary.BigEndian.PutUint64(ret[1:], uint64(l))
		return ret
	case I8:
		return []byte{i8ID, byte(l)}
	case I16:
		ret := make([]byte, 3)
		ret[0] = i16ID
		binary.BigEndian.PutUint16(ret[1:], uint16(l))
		return ret
	case I32:
		ret := make([]byte, 5)
		ret[0] = i32ID
		binary.BigEndian.PutUint32(ret[1:], uint32(l))
		return ret
	case I64:
		ret := make([]byte, 9)
		ret[0] = i64ID
		binary.BigEndian.PutUint64(ret[1:], uint64(l))
		return ret
	case U:
		ret := make([]byte, 9)
		ret[0] = uID
		binary.BigEndian.PutUint64(ret[1:], uint64(l))
		return ret
	case U8:
		return []byte{u8ID, byte(l)}
	case U16:
		ret := make([]byte, 3)
		ret[0] = u16ID
		binary.BigEndian.PutUint16(ret[1:], uint16(l))
		return ret
	case U32:
		ret := make([]byte, 5)
		ret[0] = u32ID
		binary.BigEndian.PutUint32(ret[1:], uint32(l))
		return ret
	case U64:
		ret := make([]byte, 9)
		ret[0] = u64ID
		binary.BigEndian.PutUint64(ret[1:], uint64(l))
		return ret
	default:
		panic("should have covered all literal types in ToBytes switch")
	}
}
666920
func (c Client) WithBytes(body []byte) Client {
	c.bytes = &body
	return c
}
391373
func FromBytes(b []byte) (KSUID, error) {
	var ksuid KSUID

	if len(b) != byteLength {
		return Nil, errSize
	}

	copy(ksuid[:], b)
	return ksuid, nil
}
947128
func (v Version) DataBytes(l Level) int {
	vt := &vtab[v]
	lev := &vt.level[l]
	return vt.bytes - lev.nblock*lev.check
}
1231579
func ToBytes(s string) (uint64, error) {
	parts := bytesPattern.FindStringSubmatch(strings.TrimSpace(s))
	if len(parts) < 3 {
		return 0, invalidByteQuantityError
	}

	value, err := strconv.ParseFloat(parts[1], 64)
	if err != nil || value <= 0 {
		return 0, invalidByteQuantityError
	}

	var bytes uint64
	unit := strings.ToUpper(parts[2])
	switch unit[:1] {
	case "T":
		bytes = uint64(value * TERABYTE)
	case "G":
		bytes = uint64(value * GIGABYTE)
	case "M":
		bytes = uint64(value * MEGABYTE)
	case "K":
		bytes = uint64(value * KILOBYTE)
	case "B":
		bytes = uint64(value * BYTE)
	}

	return bytes, nil
}
59602
func (t *Template) ParseBytes(b []byte) error {
	return t.Parse(bytes.NewReader(b))
}
168565
func (s *Session) GetBytes(ctx context.Context, key string) []byte {
	val := s.Get(ctx, key)
	b, ok := val.([]byte)
	if !ok {
		return nil
	}
	return b
}
153102
func (r *Encoder) EncodeBytes(b []byte) error {
	if len(b) < STR_FIXED_COUNT {
		_, err := r.w.Write([]byte{byte(STR_FIXED_START + len(b))})
		if err != nil {
			return err
		}
		_, err = r.w.Write(b)
		return err
	}

	prefix := []byte(fmt.Sprintf("%d:", len(b)))

	_, err := r.w.Write(prefix)
	if err != nil {
		return err
	}

	_, err = r.w.Write(b)
	return err
}
981551
func (r *ByteReader) ReadByte() (byte, error) {
	if r.off >= len(r.buf) {
		return 0, io.EOF
	}
	return r.readByte(), nil
}
1219749
func FromP12Bytes(bytes []byte, password string) (tls.Certificate, error) {
	key, cert, err := pkcs12.Decode(bytes, password)
	if err != nil {
		return tls.Certificate{}, err
	}
	return tls.Certificate{
		Certificate: [][]byte{cert.Raw},
		PrivateKey:  key,
		Leaf:        cert,
	}, nil
}
68907
func FromBytes(body []byte) *Map {
	var spanFilter Map
	if err := json.Unmarshal(body, &spanFilter); err != nil {
		return nil
	}
	return &spanFilter
}
1167449
func (buf *Buffer) ReadByte() (byte, error) {
	if len(buf.buf) == 0 {
		return 0, io.EOF
	}

	c := buf.buf[0]
	buf.buf[0] = 0
	buf.buf = buf.buf[1:]
	return c, nil
}