mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: offs2lohi should shift by bits, not bytes
Fixes golang/go#57291 Change-Id: I212ab8a9f47563d9c124a0f20c17df35d7aa8e6d Reviewed-on: https://go-review.googlesource.com/c/sys/+/457315 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Gopher Robot
parent
cffae8ece4
commit
72f772c4d7
@@ -1986,12 +1986,10 @@ func bytes2iovec(bs [][]byte) []Iovec {
|
||||
return iovecs
|
||||
}
|
||||
|
||||
// offs2lohi splits offs into its lower and upper unsigned long. On 64-bit
|
||||
// systems, hi will always be 0. On 32-bit systems, offs will be split in half.
|
||||
// preadv/pwritev chose this calling convention so they don't need to add a
|
||||
// padding-register for alignment on ARM.
|
||||
// offs2lohi splits offs into its low and high order bits.
|
||||
func offs2lohi(offs int64) (lo, hi uintptr) {
|
||||
return uintptr(offs), uintptr(uint64(offs) >> SizeofLong)
|
||||
const longBits = SizeofLong * 8
|
||||
return uintptr(offs), uintptr(uint64(offs) >> longBits)
|
||||
}
|
||||
|
||||
func Readv(fd int, iovs [][]byte) (n int, err error) {
|
||||
|
||||
Reference in New Issue
Block a user