aboutsummaryrefslogtreecommitdiff
path: root/lib/base/object.h
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-02-27 10:11:41 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-02-27 10:11:41 +0000
commitfbe202f33ba6acc3421fc811c33892d160ae722e (patch)
tree1d239f83d3d10e61b497e972af2ee50f90f56a98 /lib/base/object.h
parentc31218a50b890d768c6b276a702cb9c22f89fb70 (diff)
downloadenigma2-fbe202f33ba6acc3421fc811c33892d160ae722e.tar.gz
enigma2-fbe202f33ba6acc3421fc811c33892d160ae722e.zip
add optimized addref / release for x86
Diffstat (limited to 'lib/base/object.h')
-rw-r--r--lib/base/object.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/base/object.h b/lib/base/object.h
index 8cea2cd1..8ac92b83 100644
--- a/lib/base/object.h
+++ b/lib/base/object.h
@@ -140,6 +140,28 @@ public:
if (!ref) \
delete this; \
}
+ #elif defined(__i386__)
+ #define DECLARE_REF(x) \
+ private: oRefCount ref; \
+ public: void AddRef(); \
+ void Release();
+ #define DEFINE_REF(c) \
+ void c::AddRef() \
+ { \
+ __asm__ __volatile__( \
+ " incl %0 \n" \
+ : "=m" (ref.count) \
+ : "m" (ref.count); \
+ } \
+ void c::Release() \
+ { \
+ __asm__ __volatile__( \
+ " decl %0 \n" \
+ : "=m" (ref.count) \
+ : "m" (ref.count); \
+ if (!ref) \
+ delete this; \
+ }
#else
#warning use non optimized implementation of refcounting.
#define DECLARE_REF(x) \