mirror of
https://github.com/golang/go.git
synced 2025-05-30 19:52:53 +00:00
internal/poll: use internal/byteorder
Change-Id: Ied768b8b675281b340f91f4ac6f688594be8bf4e Reviewed-on: https://go-review.googlesource.com/c/go/+/585118 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
7ba8a23b67
commit
c7597a8d23
@ -5,6 +5,7 @@
|
|||||||
package poll
|
package poll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"internal/byteorder"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -224,15 +225,11 @@ func readIntLE(b []byte, size uintptr) uint64 {
|
|||||||
case 1:
|
case 1:
|
||||||
return uint64(b[0])
|
return uint64(b[0])
|
||||||
case 2:
|
case 2:
|
||||||
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
|
return uint64(byteorder.LeUint16(b))
|
||||||
return uint64(b[0]) | uint64(b[1])<<8
|
|
||||||
case 4:
|
case 4:
|
||||||
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
|
return uint64(byteorder.LeUint32(b))
|
||||||
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24
|
|
||||||
case 8:
|
case 8:
|
||||||
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
|
return uint64(byteorder.LeUint64(b))
|
||||||
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
|
|
||||||
default:
|
default:
|
||||||
panic("internal/poll: readInt with unsupported size")
|
panic("internal/poll: readInt with unsupported size")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user