diff options
| author | 2015-09-23 15:05:02 +0000 | |
|---|---|---|
| committer | 2015-09-23 15:05:02 +0000 | |
| commit | 1ec0f48cbd44a56c360d075849655ab2c3f36476 (patch) | |
| tree | ad7c52b3bd8fc68f694269b79433e75d278beaac | |
| parent | 39f1cd8045e242db411a5c3940f1ad3f9f8f8490 (diff) | |
| parent | d37734a4871013d067a033914579281bf5d1c13a (diff) | |
am d37734a4: am c6a6c6de: am ad2a1592: Merge "Enable multiple benign overflow conditions."
* commit 'd37734a4871013d067a033914579281bf5d1c13a':
Enable multiple benign overflow conditions.
| -rw-r--r-- | libs/input/VelocityTracker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/input/VelocityTracker.cpp b/libs/input/VelocityTracker.cpp index 6c70c3c9eb..7f6b1576cf 100644 --- a/libs/input/VelocityTracker.cpp +++ b/libs/input/VelocityTracker.cpp @@ -46,7 +46,8 @@ static const nsecs_t ASSUME_POINTER_STOPPED_TIME = 40 * NANOS_PER_MS; static float vectorDot(const float* a, const float* b, uint32_t m) { float r = 0; - while (m--) { + while (m) { + m--; r += *(a++) * *(b++); } return r; @@ -54,7 +55,8 @@ static float vectorDot(const float* a, const float* b, uint32_t m) { static float vectorNorm(const float* a, uint32_t m) { float r = 0; - while (m--) { + while (m) { + m--; float t = *(a++); r += t * t; } @@ -511,7 +513,8 @@ static bool solveLeastSquares(const float* x, const float* y, for (uint32_t h = 0; h < m; h++) { wy[h] = y[h] * w[h]; } - for (uint32_t i = n; i-- != 0; ) { + for (uint32_t i = n; i != 0; ) { + i--; outB[i] = vectorDot(&q[i][0], wy, m); for (uint32_t j = n - 1; j > i; j--) { outB[i] -= r[i][j] * outB[j]; |