aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debuglog.go
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2025-04-08 10:00:13 +0000
committerMichael Pratt <mpratt@google.com>2025-04-08 07:47:16 -0700
commit38a2a3c7ce156e01f8980cb97912b7067709aaa3 (patch)
tree3d3701b563e81640ba6a3376c098c16cb556a8e5 /src/runtime/debuglog.go
parent14b15a2beaed423ba6b6c97fa5983bd57999038e (diff)
downloadgo-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/debuglog.go')
-rw-r--r--src/runtime/debuglog.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/runtime/debuglog.go b/src/runtime/debuglog.go
index b11e5e3fab..50fba3568d 100644
--- a/src/runtime/debuglog.go
+++ b/src/runtime/debuglog.go
@@ -27,6 +27,7 @@ package runtime
import (
"internal/abi"
+ "internal/byteorder"
"internal/runtime/atomic"
"internal/runtime/sys"
"unsafe"
@@ -477,14 +478,7 @@ func (l *debugLogWriter) writeSync(tick, nano uint64) {
//go:nosplit
func (l *debugLogWriter) writeUint64LE(x uint64) {
var b [8]byte
- b[0] = byte(x)
- b[1] = byte(x >> 8)
- b[2] = byte(x >> 16)
- b[3] = byte(x >> 24)
- b[4] = byte(x >> 32)
- b[5] = byte(x >> 40)
- b[6] = byte(x >> 48)
- b[7] = byte(x >> 56)
+ byteorder.LEPutUint64(b[:], x)
l.bytes(b[:])
}
@@ -576,10 +570,7 @@ func (r *debugLogReader) readUint64LEAt(pos uint64) uint64 {
b[i] = r.data.b[pos%uint64(len(r.data.b))]
pos++
}
- return uint64(b[0]) | uint64(b[1])<<8 |
- uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 |
- uint64(b[6])<<48 | uint64(b[7])<<56
+ return byteorder.LEUint64(b[:])
}
func (r *debugLogReader) peek() (tick uint64) {