Golang encoding/binary.PutUvarint() function example
package encoding/binary
PutUvarint encodes a uint64 into buf(1st parameter) and returns the number of bytes written. If the buffer is too small, PutUvarint will panic.
Golang encoding/binary.PutUvarint() function usage example
func encodeBlockHandle(dst []byte, b blockHandle) int {
n := binary.PutUvarint(dst, b.offset)
m := binary.PutUvarint(dst[n:], b.length)
return n + m
}
References :
http://golang.org/pkg/encoding/binary/#PutUvarint
https://github.com/syndtr/goleveldb/blob/master/leveldb/table/table.go
Advertisement
Something interesting
Tutorials
+5.4k Gogland : Datasource explorer
+9.4k Golang : Qt Yes No and Quit message box example
+5.7k Golang : Frobnicate or tweaking a string example
+13.8k Generate salted password with OpenSSL example
+11.7k Golang : Find age or leap age from date of birth example
+7.2k Golang : Check if one string(rune) is permutation of another string(rune)
+6.4k Golang : Break string into a slice of characters example
+8.1k Golang : How To Use Panic and Recover
+7.2k CloudFlare : Another way to get visitor's real IP address
+6.9k Android Studio : Hello World example
+5.2k PHP : See installed compiled-in-modules
+14.4k Android Studio : Use image as AlertDialog title with custom layout example