mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-22 08:26:07 +01:00
17 lines
306 B
Go
17 lines
306 B
Go
|
package nlenc
|
||
|
|
||
|
import (
|
||
|
"encoding/binary"
|
||
|
)
|
||
|
|
||
|
// NativeEndian returns the native byte order of this system.
|
||
|
func NativeEndian() binary.ByteOrder {
|
||
|
// Determine endianness by storing a uint16 in a byte slice.
|
||
|
b := Uint16Bytes(1)
|
||
|
if b[0] == 1 {
|
||
|
return binary.LittleEndian
|
||
|
}
|
||
|
|
||
|
return binary.BigEndian
|
||
|
}
|