Rework encode, idiot
This commit is contained in:
@@ -28,11 +28,8 @@ type (
|
|||||||
|
|
||||||
func (p *PDU_HEADER) Encode() ([]uint8, error) {
|
func (p *PDU_HEADER) Encode() ([]uint8, error) {
|
||||||
buf := make([]uint8, 16)
|
buf := make([]uint8, 16)
|
||||||
binary.BigEndian.PutUint32(buf[0:4], p.command_length)
|
err := p.EncodeInto(&buf)
|
||||||
binary.BigEndian.PutUint32(buf[4:8], p.command_id)
|
return buf, err
|
||||||
binary.BigEndian.PutUint32(buf[8:12], p.command_status)
|
|
||||||
binary.BigEndian.PutUint32(buf[12:16], p.sequence_number)
|
|
||||||
return buf, nil
|
|
||||||
}
|
}
|
||||||
func (p *PDU_HEADER) EncodeInto(buf *[]uint8) error {
|
func (p *PDU_HEADER) EncodeInto(buf *[]uint8) error {
|
||||||
if buf == nil {
|
if buf == nil {
|
||||||
|
Reference in New Issue
Block a user