ByteOrder (Put) in Go

Posted by GoDoc
Public (Editable by Users)

A ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers.

Go
Edit
package main

import (
	"encoding/binary"
	"fmt"
)

func main() {
	b := make([]byte, 4)
	binary.LittleEndian.PutUint16(b[0:], 0x03e8)
	binary.LittleEndian.PutUint16(b[2:], 0x07d0)
	fmt.Printf("% x\n", b)
}