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