diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-09-25 23:51:40 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-09-25 23:53:22 +0200 |
commit | 4d84f6aabdb5b962a990486b588fee3d1919adde (patch) | |
tree | 2dfd70ce2499a31672aefe5a801eb1cf8c24d328 | |
parent | 01e9a432842686bd033fba84f7524a30d4bb40c7 (diff) |
An exercise in futility.
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/mastur.c | 7 |
3 files changed, 11 insertions, 1 deletions
@@ -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 @@ -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; +} |