aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2020-04-01 05:27:49 +0700
committerMatthew Dempsky <mdempsky@google.com>2020-03-31 23:39:12 +0000
commit6edd7971bb3e83356544b2cd6e7a93fdabff1246 (patch)
tree97f17bb5205184633e5dc765db35f5de9090d50d /src/runtime
parent82253ddc7a6b85240fd74cc5138f685ca931f355 (diff)
downloadgo-6edd7971bb3e83356544b2cd6e7a93fdabff1246.tar.xz
cmd/compile: optimize len check when make slice
In CL 226278, we did: if len < 0 { panicmakeslicelen } if len > cap { panicmakeslicecap } But due to the fact that cap is constrained to [0,2^31), so it is safe to do: if uint64(len) > cap { if len < 0 { panicmakeslicelen() } panicmakeslicecap() } save us a comparison in common case when len is within range. Passes toolstash-check. Change-Id: I0ebd52914ccde4cbb45f16c9e020b0c8f42e0663 Reviewed-on: https://go-review.googlesource.com/c/go/+/226737 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions