Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: swap mathutil with builtin #1626

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pkg/ioutils/lazy_reader_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"sync"

"github.com/pkg/errors"
"github.com/stackrox/rox/pkg/mathutil"
"github.com/stackrox/rox/pkg/utils"
)

Expand Down Expand Up @@ -115,7 +114,7 @@ func (r *diskBackedLazyReaderAt) readAt(p []byte, off int64) (n int, err error)
defer r.mutex.RUnlock()

if off < r.maxBufferSize {
n, err = r.lzReader.ReadAt(p[:mathutil.MinInt64(int64(len(p)), r.maxBufferSize-off)], off)
n, err = r.lzReader.ReadAt(p[:min(int64(len(p)), r.maxBufferSize-off)], off)
if err != nil || n == len(p) {
return n, err
}
Expand Down Expand Up @@ -190,7 +189,7 @@ func (r *diskBackedLazyReaderAt) ensureOverflowToDisk(till int64) {

// Copy up to the next block, aligned with size overflowBlockSize.
// This is maxed to the size of the reader.
to := mathutil.MinInt64(((till-1)/overflowBlockSize+1)*overflowBlockSize, r.size)
to := min(((till-1)/overflowBlockSize+1)*overflowBlockSize, r.size)
// If the entire reader size is required, then copy an extra byte to ensure EOF is recorded.
if to == r.size {
to++
Expand Down
Loading