Drop unnecessary cast.

Bitshift operators with signed int is supported in Go 1.13.

PiperOrigin-RevId: 285853622
This commit is contained in:
Dean Deng
2019-12-16 14:41:20 -08:00
committed by gVisor bot
parent e6f4124afd
commit 3193b2fff8
3 changed files with 20 additions and 20 deletions
+16 -16
View File
@@ -1,21 +1,21 @@
module gvisor.dev/gvisor
go 1.12
go 1.13
require (
github.com/cenkalti/backoff v0.0.0-20190506075156-2146c9339422
github.com/gofrs/flock v0.6.1-0.20180915234121-886344bea079
github.com/golang/mock v1.3.1
github.com/golang/protobuf v1.3.1
github.com/google/btree v1.0.0
github.com/google/go-cmp v0.2.0
github.com/google/subcommands v0.0.0-20190508160503-636abe8753b8
github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d
github.com/kr/pty v1.1.1
github.com/opencontainers/runtime-spec v0.1.2-0.20171211145439-b2d941ef6a78
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/vishvananda/netlink v1.0.1-0.20190318003149-adb577d4a45e
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
github.com/cenkalti/backoff v0.0.0-20190506075156-2146c9339422
github.com/gofrs/flock v0.6.1-0.20180915234121-886344bea079
github.com/golang/mock v1.3.1
github.com/golang/protobuf v1.3.1
github.com/google/btree v1.0.0
github.com/google/go-cmp v0.2.0
github.com/google/subcommands v0.0.0-20190508160503-636abe8753b8
github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d
github.com/kr/pty v1.1.1
github.com/opencontainers/runtime-spec v0.1.2-0.20171211145439-b2d941ef6a78
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/vishvananda/netlink v1.0.1-0.20190318003149-adb577d4a45e
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
)
+2 -2
View File
@@ -27,7 +27,7 @@ func fdsFromSet(t *kernel.Task, set []byte) []int {
// Append n if the n-th bit is 1.
for i, v := range set {
for j := 0; j < 8; j++ {
if (v>>uint(j))&1 == 1 {
if (v>>j)&1 == 1 {
fds = append(fds, i*8+j)
}
}
@@ -42,7 +42,7 @@ func fdSet(t *kernel.Task, nfds int, addr usermem.Addr) string {
// Calculate the size of the fd set (one bit per fd).
nBytes := (nfds + 7) / 8
nBitsInLastPartialByte := uint(nfds % 8)
nBitsInLastPartialByte := nfds % 8
set, err := linux.CopyInFDSet(t, addr, nBytes, nBitsInLastPartialByte)
if err != nil {
+2 -2
View File
@@ -198,7 +198,7 @@ func doPoll(t *kernel.Task, addr usermem.Addr, nfds uint, timeout time.Duration)
}
// CopyInFDSet copies an fd set from select(2)/pselect(2).
func CopyInFDSet(t *kernel.Task, addr usermem.Addr, nBytes int, nBitsInLastPartialByte uint) ([]byte, error) {
func CopyInFDSet(t *kernel.Task, addr usermem.Addr, nBytes, nBitsInLastPartialByte int) ([]byte, error) {
set := make([]byte, nBytes)
if addr != 0 {
@@ -222,7 +222,7 @@ func doSelect(t *kernel.Task, nfds int, readFDs, writeFDs, exceptFDs usermem.Add
// Calculate the size of the fd sets (one bit per fd).
nBytes := (nfds + 7) / 8
nBitsInLastPartialByte := uint(nfds % 8)
nBitsInLastPartialByte := nfds % 8
// Capture all the provided input vectors.
r, err := CopyInFDSet(t, readFDs, nBytes, nBitsInLastPartialByte)