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
+12.5k Golang : Forwarding a local port to a remote server example
+8.2k How to show different content from website server when AdBlock is detected?
+19k Golang : Padding data for encryption and un-padding data for decryption
+10.6k Golang : Get local time and equivalent time in different time zone
+8.2k Golang : Add build version and other information in executables
+7.1k Golang : Gorrila mux.Vars() function example
+11.6k Golang : Surveillance with web camera and OpenCV
+16k Golang : Get sub string example
+17.9k Golang : Login and logout a user after password verification and redirect example
+10.6k Android Studio : Simple input textbox and intercept key example
+6.3k Unix/Linux : Use netstat to find out IP addresses served by your website server
+23.7k Find and replace a character in a string in Go