aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/alcomplex.c36
-rw-r--r--common/alcomplex.h33
-rw-r--r--common/threads.c5
-rw-r--r--common/threads.h29
4 files changed, 33 insertions, 70 deletions
diff --git a/common/alcomplex.c b/common/alcomplex.c
index d4045aeb..851f4105 100644
--- a/common/alcomplex.c
+++ b/common/alcomplex.c
@@ -5,9 +5,39 @@
#include "math_defs.h"
-extern inline ALcomplex complex_add(ALcomplex a, ALcomplex b);
-extern inline ALcomplex complex_sub(ALcomplex a, ALcomplex b);
-extern inline ALcomplex complex_mult(ALcomplex a, ALcomplex b);
+/** Addition of two complex numbers. */
+static inline ALcomplex complex_add(ALcomplex a, ALcomplex b)
+{
+ ALcomplex result;
+
+ result.Real = a.Real + b.Real;
+ result.Imag = a.Imag + b.Imag;
+
+ return result;
+}
+
+/** Subtraction of two complex numbers. */
+static inline ALcomplex complex_sub(ALcomplex a, ALcomplex b)
+{
+ ALcomplex result;
+
+ result.Real = a.Real - b.Real;
+ result.Imag = a.Imag - b.Imag;
+
+ return result;
+}
+
+/** Multiplication of two complex numbers. */
+static inline ALcomplex complex_mult(ALcomplex a, ALcomplex b)
+{
+ ALcomplex result;
+
+ result.Real = a.Real*b.Real - a.Imag*b.Imag;
+ result.Imag = a.Imag*b.Real + a.Real*b.Imag;
+
+ return result;
+}
+
void complex_fft(ALcomplex *FFTBuffer, ALsizei FFTSize, ALdouble Sign)
{
diff --git a/common/alcomplex.h b/common/alcomplex.h
index 2418ce78..0070ac13 100644
--- a/common/alcomplex.h
+++ b/common/alcomplex.h
@@ -13,39 +13,6 @@ typedef struct ALcomplex {
ALdouble Imag;
} ALcomplex;
-/** Addition of two complex numbers. */
-inline ALcomplex complex_add(ALcomplex a, ALcomplex b)
-{
- ALcomplex result;
-
- result.Real = a.Real + b.Real;
- result.Imag = a.Imag + b.Imag;
-
- return result;
-}
-
-/** Subtraction of two complex numbers. */
-inline ALcomplex complex_sub(ALcomplex a, ALcomplex b)
-{
- ALcomplex result;
-
- result.Real = a.Real - b.Real;
- result.Imag = a.Imag - b.Imag;
-
- return result;
-}
-
-/** Multiplication of two complex numbers. */
-inline ALcomplex complex_mult(ALcomplex a, ALcomplex b)
-{
- ALcomplex result;
-
- result.Real = a.Real*b.Real - a.Imag*b.Imag;
- result.Imag = a.Imag*b.Real + a.Real*b.Imag;
-
- return result;
-}
-
/**
* Iterative implementation of 2-radix FFT (In-place algorithm). Sign = -1 is
* FFT and 1 is iFFT (inverse). Fills FFTBuffer[0...FFTSize-1] with the
diff --git a/common/threads.c b/common/threads.c
index 4cdb329d..1ecec365 100644
--- a/common/threads.c
+++ b/common/threads.c
@@ -31,13 +31,8 @@
extern inline althrd_t althrd_current(void);
extern inline int althrd_equal(althrd_t thr0, althrd_t thr1);
-extern inline void althrd_exit(int res);
extern inline void althrd_yield(void);
-extern inline int almtx_lock(almtx_t *mtx);
-extern inline int almtx_unlock(almtx_t *mtx);
-extern inline int almtx_trylock(almtx_t *mtx);
-
#ifndef UNUSED
#if defined(__cplusplus)
diff --git a/common/threads.h b/common/threads.h
index 2d1c228d..ae033931 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -59,11 +59,6 @@ inline int althrd_equal(althrd_t thr0, althrd_t thr1)
return thr0 == thr1;
}
-inline void althrd_exit(int res)
-{
- ExitThread(res);
-}
-
inline void althrd_yield(void)
{
SwitchToThread();
@@ -84,14 +79,6 @@ inline int almtx_unlock(almtx_t *mtx)
return althrd_success;
}
-inline int almtx_trylock(almtx_t *mtx)
-{
- if(!mtx) return althrd_error;
- if(!TryEnterCriticalSection(mtx))
- return althrd_busy;
- return althrd_success;
-}
-
#else
#include <stdint.h>
@@ -126,11 +113,6 @@ inline int althrd_equal(althrd_t thr0, althrd_t thr1)
return pthread_equal(thr0, thr1);
}
-inline void althrd_exit(int res)
-{
- pthread_exit((void*)(intptr_t)res);
-}
-
inline void althrd_yield(void)
{
sched_yield();
@@ -151,17 +133,6 @@ inline int almtx_unlock(almtx_t *mtx)
return althrd_success;
}
-inline int almtx_trylock(almtx_t *mtx)
-{
- int ret = pthread_mutex_trylock(mtx);
- switch(ret)
- {
- case 0: return althrd_success;
- case EBUSY: return althrd_busy;
- }
- return althrd_error;
-}
-
inline void alcall_once(alonce_flag *once, void (*callback)(void))
{