endian.go 301 B

12345678910
  1. package common
  2. import "unsafe"
  3. // IsLittleEndian checks if the current platform uses little-endian.
  4. // copied from https://github.com/ntrrg/ntgo/blob/v0.8.0/runtime/infrastructure.go#L16 (MIT License)
  5. func IsLittleEndian() bool {
  6. var x int16 = 0x0011
  7. return *(*byte)(unsafe.Pointer(&x)) == 0x11
  8. }