From: Tobias Klauser Date: Tue, 14 May 2024 11:49:35 +0000 (+0200) Subject: internal/poll: use internal/byteorder X-Git-Tag: go1.23rc1~352 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c7597a8d23ff2124c3de1dfc8f26b29a203cdf10;p=gostls13.git internal/poll: use internal/byteorder Change-Id: Ied768b8b675281b340f91f4ac6f688594be8bf4e Reviewed-on: https://go-review.googlesource.com/c/go/+/585118 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Tobias Klauser Reviewed-by: Dmitri Shuralyov --- diff --git a/src/internal/poll/fd_wasip1.go b/src/internal/poll/fd_wasip1.go index aecd89669b..195aaa9517 100644 --- a/src/internal/poll/fd_wasip1.go +++ b/src/internal/poll/fd_wasip1.go @@ -5,6 +5,7 @@ package poll import ( + "internal/byteorder" "sync/atomic" "syscall" "unsafe" @@ -224,15 +225,11 @@ func readIntLE(b []byte, size uintptr) uint64 { case 1: return uint64(b[0]) case 2: - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 + return uint64(byteorder.LeUint16(b)) case 4: - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 + return uint64(byteorder.LeUint32(b)) case 8: - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - 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 uint64(byteorder.LeUint64(b)) default: panic("internal/poll: readInt with unsupported size") }