github.com/sdibtacm/sandbox@v0.0.0-20200320120712-60470cf803dc/units/helper/endianness.go (about)

     1  package helper
     2  
     3  func IsLittleEndian() bool {
     4  	s := uint16(0xAAFF)
     5  	b := uint8(s)
     6  	return b == 0xFF
     7  }
     8  
     9  func IsBigEndian() bool {
    10  	return !IsLittleEndian()
    11  }