mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
ditch std::lldiv
so that functions can take matching parameter types (#5659)
* ditch `std::lldiv` so that functions can take matching parameter types * revert unintended change
This commit is contained in:
parent
dc88b97f37
commit
ed02f98014
2 changed files with 7 additions and 7 deletions
|
@ -119,12 +119,12 @@ int Cache::write_contiguous(CIter const begin, CIter const end) const
|
|||
return {};
|
||||
}
|
||||
|
||||
size_t Cache::get_max_blocks(int64_t max_bytes) noexcept
|
||||
size_t Cache::get_max_blocks(size_t max_bytes) noexcept
|
||||
{
|
||||
return std::lldiv(max_bytes, tr_block_info::BlockSize).quot;
|
||||
return max_bytes / tr_block_info::BlockSize;
|
||||
}
|
||||
|
||||
int Cache::set_limit(int64_t new_limit)
|
||||
int Cache::set_limit(size_t new_limit)
|
||||
{
|
||||
max_bytes_ = new_limit;
|
||||
max_blocks_ = get_max_blocks(new_limit);
|
||||
|
@ -134,7 +134,7 @@ int Cache::set_limit(int64_t new_limit)
|
|||
return cache_trim();
|
||||
}
|
||||
|
||||
Cache::Cache(tr_torrents& torrents, int64_t max_bytes)
|
||||
Cache::Cache(tr_torrents& torrents, size_t max_bytes)
|
||||
: torrents_{ torrents }
|
||||
, max_blocks_(get_max_blocks(max_bytes))
|
||||
, max_bytes_(max_bytes)
|
||||
|
|
|
@ -30,9 +30,9 @@ class Cache
|
|||
public:
|
||||
using BlockData = small::max_size_vector<uint8_t, tr_block_info::BlockSize>;
|
||||
|
||||
Cache(tr_torrents& torrents, int64_t max_bytes);
|
||||
Cache(tr_torrents& torrents, size_t max_bytes);
|
||||
|
||||
int set_limit(int64_t new_limit);
|
||||
int set_limit(size_t new_limit);
|
||||
|
||||
[[nodiscard]] constexpr auto get_limit() const noexcept
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
// @return any error code from writeContiguous()
|
||||
[[nodiscard]] int cache_trim();
|
||||
|
||||
[[nodiscard]] static size_t get_max_blocks(int64_t max_bytes) noexcept;
|
||||
[[nodiscard]] static size_t get_max_blocks(size_t max_bytes) noexcept;
|
||||
|
||||
[[nodiscard]] CIter get_block(tr_torrent const* torrent, tr_block_info::Location const& loc) noexcept;
|
||||
|
||||
|
|
Loading…
Reference in a new issue