summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-04-09 17:38:32 -0700
committerJacob Palecki <[email protected]>2021-04-09 17:38:32 -0700
commitf1aae3548db5096fbea879d5c92cec532e606e5b (patch)
tree86e5d8c489e83a653b663e11bbec8254f9360b6c
parentMostly working now (diff)
downloadrawaccel-f1aae3548db5096fbea879d5c92cec532e606e5b.tar.xz
rawaccel-f1aae3548db5096fbea879d5c92cec532e606e5b.zip
additional fixes
-rw-r--r--common/accel-lookup.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/accel-lookup.hpp b/common/accel-lookup.hpp
index 4314bfa..968eb6a 100644
--- a/common/accel-lookup.hpp
+++ b/common/accel-lookup.hpp
@@ -254,9 +254,9 @@ namespace rawaccel {
first_log_lookup_speed = exp(start*1.0);
int end = static_cast<int>(floor(log(last_point_speed)));
last_log_lookup_speed = exp(end*1.0);
- int num = static_cast<int>(capacity / (end - start));
+ int num = end > start ? static_cast<int>(capacity / (end - start)) : 1;
range = fp_rep_range{ start, end, num };
- last_log_lookup_index = num * (end - start) - 1;
+ last_log_lookup_index = end > start ? num * (end - start) - 1 : 0;
vec2<float> current = {0, 0};
vec2<float> next;