summaryrefslogtreecommitdiff
path: root/src/mastur.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-09-26 00:11:42 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-09-26 00:11:42 +0200
commitdf5f958784e350411e0b20d6a4473eb3256ac25f (patch)
tree6af5c00ea54fc7d04f875e97830769c9e6941b1e /src/mastur.c
parent599bbfd06e195a3eaed1069f2ed18fb3610198c4 (diff)
Simplify mastur to use a single lookup table.HEADmaster
Diffstat (limited to 'src/mastur.c')
-rw-r--r--src/mastur.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mastur.c b/src/mastur.c
index 7826b05..39f868d 100644
--- a/src/mastur.c
+++ b/src/mastur.c
@@ -1,7 +1,6 @@
-static const int A[] = {0, 1, -1};
-static const int C[][3] = {{1, 1, -2}, {1, 1, -2}, {-2, 1, 1}};
+static const int C[][3] = {{0, 0, 0}, {1, 1, -2}, {2, -1, -1}};
int mastur(const int i, const int x, const int y)
{
- return i + A[x] * C[x][i / y % 3] * y;
+ return i + C[x][i / y % 3] * y;
}