Debian Codegraph @

cpu/endian_test.go

raw
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package cpu_test
6
7 import (
8 "testing"
9 "unsafe"
10
11 "golang.org/x/sys/cpu"
12 )
13
14 func TestIsBigEndian(t *testing.T) {
15 b := uint16(0xff00)
16 want := *(*byte)(unsafe.Pointer(&b)) == 0xff
17 if cpu.IsBigEndian != want {
18 t.Errorf("IsBigEndian = %t, want %t",
19 cpu.IsBigEndian, want)
20 }
21 }