first commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
func IntToBytes(n int32) []byte {
|
||||
data := int32(n)
|
||||
bytebuf := bytes.NewBuffer([]byte{})
|
||||
binary.Write(bytebuf, binary.BigEndian, data)
|
||||
return bytebuf.Bytes()
|
||||
}
|
||||
func Int16ToBytes(data int16) []byte {
|
||||
bytebuf := bytes.NewBuffer([]byte{})
|
||||
binary.Write(bytebuf, binary.BigEndian, data)
|
||||
return bytebuf.Bytes()
|
||||
}
|
||||
Reference in New Issue
Block a user