| 44 | } |
| 45 | |
| 46 | size_t CalculateDbCacheBytes(const ArgsManager& args) |
| 47 | { |
| 48 | if (auto db_cache{args.GetIntArg("-dbcache")}) { |
| 49 | if (*db_cache < 0) db_cache = 0; |
| 50 | const uint64_t db_cache_bytes{SaturatingLeftShift<uint64_t>(*db_cache, 20)}; |
| 51 | constexpr auto max_db_cache{sizeof(void*) == 4 ? MAX_32BIT_DBCACHE : std::numeric_limits<size_t>::max()}; |
| 52 | return std::max<size_t>(MIN_DB_CACHE, std::min<uint64_t>(db_cache_bytes, max_db_cache)); |
| 53 | } |
| 54 | return GetDefaultDBCache(); |
| 55 | } |
| 56 | |
| 57 | CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes) |
| 58 | { |
no test coverage detected