Fix units screwup in cache size computation (bug 297714). r+sr=darin.

This commit is contained in:
bryner%brianryner.com 2005-06-16 01:46:23 +00:00
Родитель 430d2b6d8d
Коммит a4c2e3baaf
1 изменённых файлов: 6 добавлений и 3 удалений

9
netwerk/cache/src/nsCacheService.cpp поставляемый
Просмотреть файл

@ -1302,10 +1302,13 @@ nsCacheService::CacheMemoryAvailable()
if (LL_CMP(bytes, >, LL_MAXINT))
bytes = LL_MAXINT;
double bytesD;
LL_L2D(bytesD, (PRInt64) bytes);
PRUint64 kbytes;
LL_SHR(kbytes, bytes, 10);
double x = log(bytesD)/log(2.0) - 14;
double kBytesD;
LL_L2D(kBytesD, (PRInt64) kbytes);
double x = log(kBytesD)/log(2.0) - 14;
if (x > 0) {
capacity = (PRInt32)(x * x - x + 2.001); // add .001 for rounding
capacity *= 1024;