- switch i{Download,Usr}Size from double to (un)signed long long
The biggest reason is that this saves a lot of float point operations
we do in AddSizes() on integers. The only reason i see that this was
a double is that it was 64bit long and can therefore store bigger
values than int/long, but with the availablity of (un)signed long long
we are now also at 64bit and can store sizes more than 8 Exabytes big -
by the time this will be a limit the C/C++ Standard will have bigger types,
hopefully.
// Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/
// ---------------------------------------------------------------------
/* This is the total number of bytes needed */
// Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/
// ---------------------------------------------------------------------
/* This is the total number of bytes needed */
-double pkgAcquire::TotalNeeded()
+unsigned long long pkgAcquire::TotalNeeded()
+ unsigned long long Total = 0;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
Total += (*I)->FileSize;
return Total;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
Total += (*I)->FileSize;
return Total;
// Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/
// ---------------------------------------------------------------------
/* This is the number of bytes that is not local */
// Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/
// ---------------------------------------------------------------------
/* This is the number of bytes that is not local */
-double pkgAcquire::FetchNeeded()
+unsigned long long pkgAcquire::FetchNeeded()
+ unsigned long long Total = 0;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
if ((*I)->Local == false)
Total += (*I)->FileSize;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
if ((*I)->Local == false)
Total += (*I)->FileSize;
// Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/
// ---------------------------------------------------------------------
/* This is the number of bytes that is not local */
// Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/
// ---------------------------------------------------------------------
/* This is the number of bytes that is not local */
-double pkgAcquire::PartialPresent()
+unsigned long long pkgAcquire::PartialPresent()
+ unsigned long long Total = 0;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
if ((*I)->Local == false)
Total += (*I)->PartialSize;
for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
if ((*I)->Local == false)
Total += (*I)->PartialSize;
/** \return the total size in bytes of all the items included in
* this download.
*/
/** \return the total size in bytes of all the items included in
* this download.
*/
+ unsigned long long TotalNeeded();
/** \return the size in bytes of all non-local items included in
* this download.
*/
/** \return the size in bytes of all non-local items included in
* this download.
*/
+ unsigned long long FetchNeeded();
/** \return the amount of data to be fetched that is already
* present on the filesystem.
*/
/** \return the amount of data to be fetched that is already
* present on the filesystem.
*/
- double PartialPresent();
+ unsigned long long PartialPresent();
/** \brief Delayed constructor
*
/** \brief Delayed constructor
*
pkgCache *Cache;
StateCache *PkgState;
unsigned char *DepState;
pkgCache *Cache;
StateCache *PkgState;
unsigned char *DepState;
-
- double iUsrSize;
- double iDownloadSize;
+
+ /** Stores the space changes after installation */
+ signed long long iUsrSize;
+ /** Stores how much we need to download to get the packages */
+ unsigned long long iDownloadSize;
unsigned long iInstCount;
unsigned long iDelCount;
unsigned long iKeepCount;
unsigned long iInstCount;
unsigned long iDelCount;
unsigned long iKeepCount;
bool writeStateFile(OpProgress *prog, bool InstalledOnly=true);
// Size queries
bool writeStateFile(OpProgress *prog, bool InstalledOnly=true);
// Size queries
- inline double UsrSize() {return iUsrSize;};
- inline double DebSize() {return iDownloadSize;};
+ inline signed long long UsrSize() {return iUsrSize;};
+ inline unsigned long long DebSize() {return iDownloadSize;};
inline unsigned long DelCount() {return iDelCount;};
inline unsigned long KeepCount() {return iKeepCount;};
inline unsigned long InstCount() {return iInstCount;};
inline unsigned long DelCount() {return iDelCount;};
inline unsigned long KeepCount() {return iKeepCount;};
inline unsigned long InstCount() {return iInstCount;};
- deal with long long, not with int to remove 2GB Limit (LP: #250909)
- deprecate AddSize with Multiplier as it is unused and switch to
boolean instead to handle the sizes more gracefully.
- deal with long long, not with int to remove 2GB Limit (LP: #250909)
- deprecate AddSize with Multiplier as it is unused and switch to
boolean instead to handle the sizes more gracefully.
+ - switch i{Download,Usr}Size from double to (un)signed long long
-- David Kalnischkies <kalnischkies@gmail.com> Thu, 03 Jun 2010 09:19:01 +0200
-- David Kalnischkies <kalnischkies@gmail.com> Thu, 03 Jun 2010 09:19:01 +0200