Skip to content

Commit ace810b

Browse files
authored
Fix fixed pointer size problem in AtomicBucketWrapArray to support 32-bit OS (#429)
1 parent 671274f commit ace810b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

core/stat/base/leap_array.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ import (
2626
"github.com/pkg/errors"
2727
)
2828

29-
const (
30-
PtrSize = int(8)
31-
)
32-
3329
// BucketWrap represent a slot to record metrics
3430
// In order to reduce the usage of memory, BucketWrap don't hold length of BucketWrap
3531
// The length of BucketWrap could be seen in LeapArray.
@@ -115,7 +111,7 @@ func (aa *AtomicBucketWrapArray) elementOffset(idx int) (unsafe.Pointer, bool) {
115111
return nil, false
116112
}
117113
basePtr := aa.base
118-
return unsafe.Pointer(uintptr(basePtr) + uintptr(idx*PtrSize)), true
114+
return unsafe.Pointer(uintptr(basePtr) + uintptr(idx)*unsafe.Sizeof(basePtr)), true
119115
}
120116

121117
func (aa *AtomicBucketWrapArray) get(idx int) *BucketWrap {

0 commit comments

Comments
 (0)