From ce9053c15affb2a1a99d1157b85266d70aec601b Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Wed, 15 Oct 2008 10:16:07 +0400 Subject: [PATCH] ptr.h: use unsigned int to store reference counts (in order to save memory). We'll hardly ever get more than 2^32 references to the same object. So using size_t to store reference count only wastes 4 bytes per object (on 64-bit architecture). Use unsigned int instead. --- ginac/ptr.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ginac/ptr.h b/ginac/ptr.h index c8b06912..db7f9582 100644 --- a/ginac/ptr.h +++ b/ginac/ptr.h @@ -37,13 +37,13 @@ class refcounted { public: refcounted() throw() : refcount(0) {} - size_t add_reference() throw() { return ++refcount; } - size_t remove_reference() throw() { return --refcount; } - size_t get_refcount() const throw() { return refcount; } - void set_refcount(size_t r) throw() { refcount = r; } + unsigned int add_reference() throw() { return ++refcount; } + unsigned int remove_reference() throw() { return --refcount; } + unsigned int get_refcount() const throw() { return refcount; } + void set_refcount(unsigned int r) throw() { refcount = r; } private: - size_t refcount; ///< reference counter + unsigned int refcount; ///< reference counter }; -- 2.49.0