aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/chan.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-02-29 15:01:00 -0800
committerMatthew Dempsky <mdempsky@google.com>2016-03-07 20:53:27 +0000
commita03bdc3e6bea34abd5077205371e6fb9ef354481 (patch)
tree305aea0c37fe51db90660eef9133e6254ebf864a /src/runtime/chan.go
parent1ec4f227f45f669dfcc017b1eb1d147aca5ac620 (diff)
downloadgo-a03bdc3e6bea34abd5077205371e6fb9ef354481.tar.gz
go-a03bdc3e6bea34abd5077205371e6fb9ef354481.zip
runtime: eliminate unnecessary type conversions
Automated refactoring produced using github.com/mdempsky/unconvert. Change-Id: Iacf871a4f221ef17f48999a464ab2858b2bbaa90 Reviewed-on: https://go-review.googlesource.com/20071 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/chan.go')
-rw-r--r--src/runtime/chan.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/chan.go b/src/runtime/chan.go
index 2fc0839600..85cbe5a5a7 100644
--- a/src/runtime/chan.go
+++ b/src/runtime/chan.go
@@ -56,7 +56,7 @@ func makechan(t *chantype, size int64) *hchan {
if hchanSize%maxAlign != 0 || elem.align > maxAlign {
throw("makechan: bad alignment")
}
- if size < 0 || int64(uintptr(size)) != size || (elem.size > 0 && uintptr(size) > (_MaxMem-hchanSize)/uintptr(elem.size)) {
+ if size < 0 || int64(uintptr(size)) != size || (elem.size > 0 && uintptr(size) > (_MaxMem-hchanSize)/elem.size) {
panic("makechan: size out of range")
}
@@ -67,7 +67,7 @@ func makechan(t *chantype, size int64) *hchan {
// buf points into the same allocation, elemtype is persistent.
// SudoG's are referenced from their owning thread so they can't be collected.
// TODO(dvyukov,rlh): Rethink when collector can move allocated objects.
- c = (*hchan)(mallocgc(hchanSize+uintptr(size)*uintptr(elem.size), nil, flagNoScan))
+ c = (*hchan)(mallocgc(hchanSize+uintptr(size)*elem.size, nil, flagNoScan))
if size > 0 && elem.size != 0 {
c.buf = add(unsafe.Pointer(c), hchanSize)
} else {
@@ -227,7 +227,7 @@ func chansend(t *chantype, c *hchan, ep unsafe.Pointer, block bool, callerpc uin
}
gp.param = nil
if mysg.releasetime > 0 {
- blockevent(int64(mysg.releasetime)-t0, 2)
+ blockevent(mysg.releasetime-t0, 2)
}
releaseSudog(mysg)
return true