summaryrefslogtreecommitdiff
path: root/src/mastur.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mastur.c')
-rw-r--r--src/mastur.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mastur.c b/src/mastur.c
new file mode 100644
index 0000000..7826b05
--- /dev/null
+++ b/src/mastur.c
@@ -0,0 +1,7 @@
+static const int A[] = {0, 1, -1};
+static const int C[][3] = {{1, 1, -2}, {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;
+}