github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/unsafekit/memarch_le.go (about)

     1  // Copyright 2020 Insolar Network Ltd.
     2  // All rights reserved.
     3  // This material is licensed under the Insolar License version 1.0,
     4  // available at https://github.com/insolar/assured-ledger/blob/master/LICENSE.md.
     5  
     6  // +build 386 amd64 amd64p32 arm arm64 mips64le mipsle ppc64le wasm
     7  
     8  package unsafekit
     9  
    10  import "unsafe"
    11  
    12  const BigEndian = false // unfortunately, sys.BigEndian is inaccessible
    13  
    14  func init() {
    15  	bytes := [4]byte{1, 2, 3, 4}
    16  	v := *((*uint32)((unsafe.Pointer)(&bytes)))
    17  	if v != 0x04030201 {
    18  		panic("FATAL - expected LittleEndian memory architecture")
    19  	}
    20  }