We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c43fe1e commit 352d833Copy full SHA for 352d833
cpu/endian_test.go
@@ -0,0 +1,21 @@
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
+}
0 commit comments