aboutsummaryrefslogtreecommitdiff
path: root/lib/bytes/bytes.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-09-08 02:34:21 +0700
committerShulhan <ms@kilabit.info>2018-09-08 02:34:21 +0700
commit7715649d03ff004eb306ba4082eeefef7a6dd49c (patch)
treeb62a8cbc29fc50b9b68d2999cd4d363f064530f4 /lib/bytes/bytes.go
parent210f1d0bafeedb148c18ee63e2571fbda66469d2 (diff)
downloadpakakeh.go-7715649d03ff004eb306ba4082eeefef7a6dd49c.tar.xz
lib/bytes: add function to write uint32
Diffstat (limited to 'lib/bytes/bytes.go')
-rw-r--r--lib/bytes/bytes.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bytes/bytes.go b/lib/bytes/bytes.go
index 5fdff819..84b1d309 100644
--- a/lib/bytes/bytes.go
+++ b/lib/bytes/bytes.go
@@ -84,6 +84,16 @@ func WriteUint16(data *[]byte, x uint, v uint16) {
}
//
+// WriteUint32 into slice of byte.
+//
+func WriteUint32(data *[]byte, x uint, v uint32) {
+ (*data)[x] = byte(v >> 24)
+ (*data)[x+1] = byte(v >> 16)
+ (*data)[x+2] = byte(v >> 8)
+ (*data)[x+3] = byte(v)
+}
+
+//
// AppendInt16 into slice of byte.
//
func AppendInt16(data *[]byte, v int16) {