From 4d84f6aabdb5b962a990486b588fee3d1919adde Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 25 Sep 2018 23:51:40 +0200 Subject: An exercise in futility. --- Makefile | 1 + src/main.c | 4 +++- src/mastur.c | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/mastur.c diff --git a/Makefile b/Makefile index 3d16add..f069ef2 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ SRC := src/bigtab.c \ src/new32.c \ src/new32v2.c \ src/new32v3.c \ + src/mastur.c \ src/null.c \ src/ref.c diff --git a/src/main.c b/src/main.c index ca3efc8..6651ff3 100644 --- a/src/main.c +++ b/src/main.c @@ -21,6 +21,7 @@ int new(int i, int x, int y); int new32(int i, int x, int y); int new32v2(int i, int x, int y); int new32v3(int i, int x, int y); +int mastur(int i, int x, int y); void bigtab_init(void); int bigtab(int i, int x, int y); @@ -40,7 +41,8 @@ static struct solfunc solfuncs[ ] = { {"new", new}, {"new32", new32}, {"new32v2", new32v2}, - {"new32v3", new32v3} + {"new32v3", new32v3}, + {"mastur", mastur} }; #define PASSES 5 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; +} -- cgit