Skip to content

Commit 194d4be

Browse files
authored
Fix LeapArray integer overflow problem on 32-bit platform (#422)
Signed-off-by: Long Dai <[email protected]>
1 parent a99057c commit 194d4be

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

core/stat/base/leap_array.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ func NewAtomicBucketWrapArrayWithTime(len int, bucketLengthInMs uint32, now uint
7070
data: make([]*BucketWrap, len),
7171
}
7272

73-
timeId := now / uint64(bucketLengthInMs)
74-
idx := int(timeId) % len
73+
idx := int((now / uint64(bucketLengthInMs)) % uint64(len))
7574
startTime := calculateStartTime(now, bucketLengthInMs)
7675

7776
for i := idx; i <= len-1; i++ {

0 commit comments

Comments
 (0)