[med-svn] [SCM] aghermann branch, master, updated. 551e213a23b59b71cba6a9c3a282d1b60e21b854

Andrei Zavada johnhommer at gmail.com
Sun Apr 21 23:18:21 UTC 2013


The following commit has been merged in the master branch:
commit f2a2040b11a465e2e5a42fcf51b4a4aa78e3ef27
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Mon Apr 22 02:13:49 2013 +0300

    don't let a double be a valarray index

diff --git a/src/libsigfile/edf.ii b/src/libsigfile/edf.ii
index cdb778b..d52b7ec 100644
--- a/src/libsigfile/edf.ii
+++ b/src/libsigfile/edf.ii
@@ -83,13 +83,15 @@ get_region_filtered_( Th h,
       // artifacts
 	size_t this_samplerate = H.samples_per_record / data_record_size;
 	for ( auto &A : H.artifacts() ) {
-		if ( unlikely (this_samplerate * A.a >= smplz) )
+		size_t	Aa = A.a * this_samplerate,
+			Az = A.z * this_samplerate;
+		if ( unlikely (Aa >= smplz) )
 			break;
-		size_t	run = (A.z - A.a) * this_samplerate,
+		size_t	run = (Az - Aa),
 			window = min( run, this_samplerate),
 			t;
-		if ( unlikely (A.z * this_samplerate > smplz) )
-			run = smplz - A.a * this_samplerate;
+		if ( unlikely (Az > smplz) )
+			run = smplz - Aa;
 		valarray<TFloat>
 			W (run);
 
@@ -111,7 +113,7 @@ get_region_filtered_( Th h,
 				W[t] = (1 - sigproc::winf[(size_t)H.artifacts.dampen_window_type]( t, window));
 
 		// now gently apply the multiplier vector onto the artifacts
-		recp[ slice(A.a * this_samplerate, run, 1) ] *= (W * (TFloat)H.artifacts.factor);
+		recp[ slice(Aa, run, 1) ] *= (W * (TFloat)H.artifacts.factor);
 	}
 
       // filters

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list