aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flcontainers.h
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-02-27 04:56:10 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-02-27 04:56:10 +0000
commit3e90874e5d63137c195c3b3c1ce90b542deb8a51 (patch)
tree95f9b19ec8a3f579f976c3d80e4eae639867ea97 /externals/grill/flext/source/flcontainers.h
parent7d9437c8a5fed2d03c22454f643b4bf5598f2d9e (diff)
small name change and reuse of Fifo cells
fixed eol-style new lock-free lifo and fifo fixes for linux eliminated ChannelsIn/ChannelsOut updated docs build system: added profiler mode, more fixes fix for linux autodetection of build platform fix for flext_dsp @ Max svn path=/trunk/; revision=2584
Diffstat (limited to 'externals/grill/flext/source/flcontainers.h')
-rw-r--r--externals/grill/flext/source/flcontainers.h46
1 files changed, 34 insertions, 12 deletions
diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h
index 562bbf64..14d793de 100644
--- a/externals/grill/flext/source/flcontainers.h
+++ b/externals/grill/flext/source/flcontainers.h
@@ -21,15 +21,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flprefix.h"
-class Cell
-{
- friend class Lifo;
- friend class Fifo;
-private:
- Cell *link;
-};
-
-
#if 1 //def __Pentium__
#define VTYPE volatile
#else
@@ -42,6 +33,14 @@ private:
class FLEXT_SHARE Lifo
{
public:
+ class Cell
+ {
+ friend class Lifo;
+ friend class Fifo;
+ private:
+ Cell *link;
+ };
+
inline Lifo() { Init(); }
inline void Init() { ic = oc = 0; top = NULL; }
@@ -113,7 +112,7 @@ public:
}
inline size_t Size() const { return ic-oc; }
-#elif defined(__GNUC__) && defined(__)
+#elif defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__))
#ifndef SMPLOCK
# ifdef __SMP__
# define SMPLOCK "lock ; "
@@ -145,7 +144,7 @@ public:
inline Cell *Pop()
{
- cell* v=0;
+ Cell *v=0;
__asm__ __volatile__ (
"# LFPOP \n\t"
"pushl %%ebx \n\t"
@@ -171,7 +170,7 @@ public:
return v;
}
- inline size_t Size()
+ inline size_t Size() const
{
size_t n;
__asm__ __volatile__ (
@@ -258,10 +257,22 @@ private:
#endif
};
+template <typename T>
+class TypedLifo
+ : public Lifo
+{
+public:
+ inline T *Avail() { return static_cast<T *>(Lifo::Avail()); }
+ inline void Push(T *c) { Lifo::Push(static_cast<T *>(c)); }
+ inline T *Pop() { return static_cast<T *>(Lifo::Pop()); }
+};
+
class FLEXT_SHARE Fifo
{
public:
+ typedef Lifo::Cell Cell;
+
void Init() { in.Init(); out.Init(); }
inline size_t Size() const { return in.Size()+out.Size(); }
@@ -311,5 +322,16 @@ public:
Lifo in,out;
};
+template <typename T>
+class TypedFifo
+ : public Fifo
+{
+public:
+ inline T *Avail() { return static_cast<T *>(Fifo::Avail()); }
+ inline void Put(T *c) { Fifo::Put(static_cast<T *>(c)); }
+ inline T *Get() { return static_cast<T *>(Fifo::Get()); }
+ inline T *Clear() { return static_cast<T *>(Fifo::Clear()); }
+};
+
#endif