From 81305a0b30cc12aa6d32081bbdcf930907ecfbbe Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Jun 2010 09:50:06 +0200 Subject: deprecate AddSize with Multiplier as it is unused and switch to boolean instead to handle the sizes more gracefully. --- apt-pkg/depcache.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apt-pkg/depcache.h') diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 3decc7a5f..d4258438f 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -321,8 +321,9 @@ class pkgDepCache : protected pkgCache::Namespace void Update(PkgIterator const &P); // Count manipulators - void AddSizes(const PkgIterator &Pkg,signed long Mult = 1); - inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg,-1);}; + void AddSizes(const PkgIterator &Pkg, bool const &Invert = false); + inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);}; + void AddSizes(const PkgIterator &Pkg,signed long Mult) __deprecated; void AddStates(const PkgIterator &Pkg,int Add = 1); inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,-1);}; -- cgit v1.2.3 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/depcache.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'apt-pkg/depcache.h') diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index d4258438f..c6f245a80 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -286,9 +286,11 @@ class pkgDepCache : protected pkgCache::Namespace 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; @@ -452,8 +454,8 @@ class pkgDepCache : protected pkgCache::Namespace 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;}; -- cgit v1.2.3