[med-svn] [SCM] aghermann branch, master, updated. 505432cf6ab4f88fa0a0d245da279903586957f3
Andrei Zavada
johnhommer at gmail.com
Mon Apr 1 20:54:35 UTC 2013
The following commit has been merged in the master branch:
commit 07728ee3c0508686efb606d098bce04c4ce320ff
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Mon Mar 11 15:38:32 2013 +0200
enforce more c++ discipline in places
diff --git a/src/common/alg.hh b/src/common/alg.hh
index 9d7064f..9195401 100644
--- a/src/common/alg.hh
+++ b/src/common/alg.hh
@@ -26,17 +26,19 @@ namespace alg {
template <typename T>
inline void
-pod_swap( T& a, T& b)
+__attribute__ ((pure))
+pod_swap( T&& a, T&& b)
{
- T tmp = a;
- a = b;
- b = tmp;
+ T tmp = move(a);
+ a = move(b);
+ b = move(tmp);
}
template <typename T>
inline bool
+__attribute__ ((pure))
overlap( const T& a, const T& b,
const T& c, const T& d)
{
@@ -44,7 +46,8 @@ overlap( const T& a, const T& b,
}
template <typename T>
-bool
+inline bool
+__attribute__ ((pure))
between( const T& a, const T& b, const T&c)
{
return a <= b && b <= c;
@@ -114,6 +117,7 @@ struct SSpan {
template <typename T>
int
+__attribute__ ((pure))
sign( T x)
{
return (x > 0) ? 1 : (x == 0) ? 0 : -1;
@@ -122,6 +126,7 @@ sign( T x)
template <typename T>
void
+__attribute__ ((pure))
ensure_within( T& v, const T& l, const T& h)
{
if ( v < l )
@@ -132,6 +137,7 @@ ensure_within( T& v, const T& l, const T& h)
template <typename T>
T
+__attribute__ ((pure))
value_within( const T& v, const T& l, const T& h)
{
T o {v};
@@ -145,16 +151,17 @@ value_within( const T& v, const T& l, const T& h)
inline valarray<double>
+__attribute__ ((pure))
to_vad( valarray<double>&& rv)
{
return move(rv);
}
inline valarray<double>
+__attribute__ ((pure))
to_vad( const valarray<float>& rv)
{
- valarray<double> ret;
- ret.resize( rv.size());
+ valarray<double> ret (rv.size());
for ( size_t i = 0; i < rv.size(); ++i )
ret[i] = rv[i];
return ret;
diff --git a/src/sigproc/winfun.cc b/src/sigproc/winfun.cc
index e844152..104d663 100644
--- a/src/sigproc/winfun.cc
+++ b/src/sigproc/winfun.cc
@@ -27,10 +27,12 @@ const char*
};
-// The following window functions have been taken from fft.c, part of WFDB package
+namespace {
#define TWOPI (M_PI*2)
+// The following window functions have been taken from fft.c, part of WFDB package
+
/* See Oppenheim & Schafer, Digital Signal Processing, p. 241 (1st ed.) */
TFloat
__attribute__ ((const))
@@ -118,7 +120,7 @@ win_welch( size_t j, size_t n)
return w;
}
-
+} // namespace
TFloat (*sigproc::winf[])(size_t, size_t) = {
win_bartlett,
--
Sleep experiment manager
More information about the debian-med-commit
mailing list