forked from urdt/ussd
Added a function to convert int to []byte
This commit is contained in:
parent
f733fe5636
commit
a659fb06fa
@ -88,3 +88,10 @@ func (d DataTyp) ToBytes() []byte {
|
|||||||
binary.BigEndian.PutUint16(bytes, uint16(d))
|
binary.BigEndian.PutUint16(bytes, uint16(d))
|
||||||
return bytes
|
return bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert int to []byte
|
||||||
|
func IntToBytes(value int) []byte {
|
||||||
|
bytes := make([]byte, 2)
|
||||||
|
binary.BigEndian.PutUint16(bytes, uint16(value))
|
||||||
|
return bytes
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user