Switch from GPLv2 to GPLv2+
[fw/altos] / ao-tools / lib / cc-analyse.c
index cdb16f02fc6b619593cbd4c027a7454756ede714..52df66e666019e02c745db16e94e658180d7c339 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 #include "cc.h"
 #include <math.h>
 
+void
+cc_timedata_limits(struct cc_timedata *d, double min_time, double max_time, int *start, int *stop)
+{
+       int     i;
+
+       *start = -1;
+       for (i = 0; i < d->num; i++) {
+               if (*start < 0 && min_time <= d->data[i].time)
+                       *start = i;
+               if (d->data[i].time <= max_time)
+                       *stop = i;
+       }
+}
+
 int
 cc_timedata_min(struct cc_timedata *d, double min_time, double max_time)
 {