Documentation ¶
Overview ¶
Package endian exposes the native byte order of GOARCH.
You should not use this package before reading and understanding this article by Rob Pike: https://commandcenter.blogspot.fr/2012/04/byte-order-fallacy.html
This package could be useful ONLY to workaround bugs in other software.
Note: reading godoc on one particular platform may be misleading. Check this:
GOARCH=amd64 godoc github.com/dolmen-go/endian GOARCH=mips64 godoc github.com/dolmen-go/endian GOARCH=unknown godoc github.com/dolmen-go/endian
Example ¶
package main import ( "fmt" "runtime" "github.com/dolmen-go/endian" ) func main() { fmt.Printf("GOARCH=%s: %s\n", runtime.GOARCH, endian.Native) const n = 0xDeadBeef var b [4]byte endian.Native.PutUint32(b[:], n) fmt.Printf("0x%x => [% x]\n", n, b) }
Output: GOARCH=amd64: LittleEndian 0xdeadbeef => [ef be ad de]
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Native = binary.LittleEndian
Native is the byte order of GOARCH.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.