@@ -128,10 +128,9 @@ func growslice(et *_type, old slice, cap int) slice {
128
128
129
129
var overflow bool
130
130
var lenmem , newlenmem , capmem uintptr
131
- const ptrSize = unsafe .Sizeof ((* byte )(nil ))
132
131
// Specialize for common values of et.size.
133
132
// For 1 we don't need any division/multiplication.
134
- // For ptrSize , compiler will optimize division/multiplication into a shift by a constant.
133
+ // For sys.PtrSize , compiler will optimize division/multiplication into a shift by a constant.
135
134
// For powers of 2, use a variable shift.
136
135
switch {
137
136
case et .size == 1 :
@@ -140,15 +139,15 @@ func growslice(et *_type, old slice, cap int) slice {
140
139
capmem = roundupsize (uintptr (newcap ))
141
140
overflow = uintptr (newcap ) > maxAlloc
142
141
newcap = int (capmem )
143
- case et .size == ptrSize :
144
- lenmem = uintptr (old .len ) * ptrSize
145
- newlenmem = uintptr (cap ) * ptrSize
146
- capmem = roundupsize (uintptr (newcap ) * ptrSize )
147
- overflow = uintptr (newcap ) > maxAlloc / ptrSize
148
- newcap = int (capmem / ptrSize )
142
+ case et .size == sys . PtrSize :
143
+ lenmem = uintptr (old .len ) * sys . PtrSize
144
+ newlenmem = uintptr (cap ) * sys . PtrSize
145
+ capmem = roundupsize (uintptr (newcap ) * sys . PtrSize )
146
+ overflow = uintptr (newcap ) > maxAlloc / sys . PtrSize
147
+ newcap = int (capmem / sys . PtrSize )
149
148
case isPowerOfTwo (et .size ):
150
149
var shift uintptr
151
- if ptrSize == 8 {
150
+ if sys . PtrSize == 8 {
152
151
// Mask shift for better code generation.
153
152
shift = uintptr (sys .Ctz64 (uint64 (et .size ))) & 63
154
153
} else {
0 commit comments