unix: avoid false positive in vet shift check
A uint64 >> 64 is reported as a mistake by the vet shift check.
This is arguably a bug in vet, but we can't fix the old releases,
so work around it.
Works around golang/go#58030.
Change-Id: Ic6b9ee2eb4bf01c77d9f7fcedb35562f733fce60
Reviewed-on: https://go-review.googlesource.com/c/sys/+/463675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index d839962..bea511f 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -1999,7 +1999,7 @@
// offs2lohi splits offs into its low and high order bits.
func offs2lohi(offs int64) (lo, hi uintptr) {
const longBits = SizeofLong * 8
- return uintptr(offs), uintptr(uint64(offs) >> longBits)
+ return uintptr(offs), uintptr(uint64(offs) >> (longBits - 1) >> 1) // two shifts to avoid false positive in vet
}
func Readv(fd int, iovs [][]byte) (n int, err error) {