2,190
社区成员
发帖
与我相关
我的任务
分享
func WriteUint16(b []byte, n uint16) {
b[0] = byte(n & 0xff)
b[1] = byte(n >> 8)
}
func main() {
words := []byte{0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x20,0x21,0x22,0x23,0x24,0x25}
WriteUint16(words[2:4], uint16(len(words)))
}