From a3c4c81afe25377020470ff71c1362136437397c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Jun 2010 10:45:58 +0200 Subject: * apt-pkg/depcache.cc: - 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. --- apt-pkg/acquire.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apt-pkg/acquire.cc') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 832eaa02c..63825da93 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -506,9 +506,9 @@ bool pkgAcquire::Clean(string Dir) // Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/ // --------------------------------------------------------------------- /* This is the total number of bytes needed */ -double pkgAcquire::TotalNeeded() +unsigned long long pkgAcquire::TotalNeeded() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) Total += (*I)->FileSize; return Total; @@ -517,9 +517,9 @@ double pkgAcquire::TotalNeeded() // 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() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) if ((*I)->Local == false) Total += (*I)->FileSize; @@ -529,9 +529,9 @@ double pkgAcquire::FetchNeeded() // 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() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) if ((*I)->Local == false) Total += (*I)->PartialSize; -- cgit v1.2.3