diff options
| author | apocelipes <seve3r@outlook.com> | 2025-04-08 10:00:13 +0000 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2025-04-08 07:47:16 -0700 |
| commit | 38a2a3c7ce156e01f8980cb97912b7067709aaa3 (patch) | |
| tree | 3d3701b563e81640ba6a3376c098c16cb556a8e5 /src/runtime/alg.go | |
| parent | 14b15a2beaed423ba6b6c97fa5983bd57999038e (diff) | |
| download | go-38a2a3c7ce156e01f8980cb97912b7067709aaa3.tar.xz | |
runtime: use internal/byteorder
To simplify the code.
Change-Id: Ib1af5009cc25bb29fd26fdb7b29ff4579f0150aa
GitHub-Last-Rev: f698a8a771ac8c6ecb745ea4c27a7c677c1789d1
GitHub-Pull-Request: golang/go#73255
Reviewed-on: https://go-review.googlesource.com/c/go/+/663735
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/alg.go')
| -rw-r--r-- | src/runtime/alg.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go index 07c115f74d..4626899aaf 100644 --- a/src/runtime/alg.go +++ b/src/runtime/alg.go @@ -6,6 +6,7 @@ package runtime import ( "internal/abi" + "internal/byteorder" "internal/cpu" "internal/goarch" "internal/runtime/sys" @@ -474,16 +475,15 @@ func initAlgAES() { func readUnaligned32(p unsafe.Pointer) uint32 { q := (*[4]byte)(p) if goarch.BigEndian { - return uint32(q[3]) | uint32(q[2])<<8 | uint32(q[1])<<16 | uint32(q[0])<<24 + return byteorder.BEUint32(q[:]) } - return uint32(q[0]) | uint32(q[1])<<8 | uint32(q[2])<<16 | uint32(q[3])<<24 + return byteorder.LEUint32(q[:]) } func readUnaligned64(p unsafe.Pointer) uint64 { q := (*[8]byte)(p) if goarch.BigEndian { - return uint64(q[7]) | uint64(q[6])<<8 | uint64(q[5])<<16 | uint64(q[4])<<24 | - uint64(q[3])<<32 | uint64(q[2])<<40 | uint64(q[1])<<48 | uint64(q[0])<<56 + return byteorder.BEUint64(q[:]) } - return uint64(q[0]) | uint64(q[1])<<8 | uint64(q[2])<<16 | uint64(q[3])<<24 | uint64(q[4])<<32 | uint64(q[5])<<40 | uint64(q[6])<<48 | uint64(q[7])<<56 + return byteorder.LEUint64(q[:]) } |
