Skip to content

Commit

Permalink
Fix LeapArray integer overflow problem on 32-bit platform (#422)
Browse files Browse the repository at this point in the history
Signed-off-by: Long Dai <[email protected]>
  • Loading branch information
daixiang0 authored Jul 28, 2021
1 parent a99057c commit 194d4be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/stat/base/leap_array.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func NewAtomicBucketWrapArrayWithTime(len int, bucketLengthInMs uint32, now uint
data: make([]*BucketWrap, len),
}

timeId := now / uint64(bucketLengthInMs)
idx := int(timeId) % len
idx := int((now / uint64(bucketLengthInMs)) % uint64(len))
startTime := calculateStartTime(now, bucketLengthInMs)

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

0 comments on commit 194d4be

Please sign in to comment.