From 5c2dfb52060e5e473e271e8fc04674cd55228a00 Mon Sep 17 00:00:00 2001 From: sanxun0325 Date: Wed, 15 Sep 2021 09:59:04 +0800 Subject: [PATCH] atomicBucketWrapArray supports 32-bit os --- core/stat/base/leap_array.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/stat/base/leap_array.go b/core/stat/base/leap_array.go index cc581a66..e76036ba 100644 --- a/core/stat/base/leap_array.go +++ b/core/stat/base/leap_array.go @@ -26,10 +26,6 @@ import ( "github.com/pkg/errors" ) -const ( - PtrSize = int(8) -) - // BucketWrap represent a slot to record metrics // In order to reduce the usage of memory, BucketWrap don't hold length of BucketWrap // The length of BucketWrap could be seen in LeapArray. @@ -115,7 +111,7 @@ func (aa *AtomicBucketWrapArray) elementOffset(idx int) (unsafe.Pointer, bool) { return nil, false } basePtr := aa.base - return unsafe.Pointer(uintptr(basePtr) + uintptr(idx*PtrSize)), true + return unsafe.Pointer(uintptr(basePtr) + uintptr(idx)*unsafe.Sizeof(basePtr)), true } func (aa *AtomicBucketWrapArray) get(idx int) *BucketWrap {