]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] internal/reflectlite: use goarch.PtrSize instead of the duplicated...
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 16 Jun 2021 22:07:16 +0000 (22:07 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 17 Jun 2021 21:29:35 +0000 (21:29 +0000)
[git-generate]
cd src/internal/reflectlite
gofmt -w -r "ptrSize -> goarch.PtrSize" .
goimports -w *.go

Change-Id: I6a55f2aa035ed863785856ddd4fcc519dec15ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/328347
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/internal/reflectlite/swapper.go
src/internal/reflectlite/value.go

index 6330ab2d34668dd8f85719120befb61cd75c1984..ac081d49bbbe9caada596c3c6bfa536b2c769a72 100644 (file)
@@ -5,6 +5,7 @@
 package reflectlite
 
 import (
+       "internal/goarch"
        "internal/unsafeheader"
        "unsafe"
 )
@@ -36,7 +37,7 @@ func Swapper(slice interface{}) func(i, j int) {
 
        // Some common & small cases, without using memmove:
        if hasPtr {
-               if size == ptrSize {
+               if size == goarch.PtrSize {
                        ps := *(*[]unsafe.Pointer)(v.ptr)
                        return func(i, j int) { ps[i], ps[j] = ps[j], ps[i] }
                }
index 0365eeeabf634f0ad2c1a88709b49bbc66ae70bb..86dfcb5c3623ea937e40e37a6d18c960c21ea9e8 100644 (file)
@@ -5,6 +5,7 @@
 package reflectlite
 
 import (
+       "internal/goarch"
        "internal/unsafeheader"
        "runtime"
        "unsafe"
@@ -90,7 +91,7 @@ func (f flag) ro() flag {
 // pointer returns the underlying pointer represented by v.
 // v.Kind() must be Ptr, Map, Chan, Func, or UnsafePointer
 func (v Value) pointer() unsafe.Pointer {
-       if v.typ.size != ptrSize || !v.typ.pointers() {
+       if v.typ.size != goarch.PtrSize || !v.typ.pointers() {
                panic("can't call pointer on a non-pointer Value")
        }
        if v.flag&flagIndir != 0 {