aboutsummaryrefslogtreecommitdiff
path: root/doc/CUBE_INTERNAL.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/CUBE_INTERNAL.md')
-rw-r--r--doc/CUBE_INTERNAL.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/CUBE_INTERNAL.md b/doc/CUBE_INTERNAL.md
new file mode 100644
index 0000000..fd3148a
--- /dev/null
+++ b/doc/CUBE_INTERNAL.md
@@ -0,0 +1,24 @@
1# Internal representation of the cube
2
3The plan (TODO) is to have multiple implementations: some that
4take advantage of advanced CPU instructions (SIMD) and a fallback
5"array" representation that works on any architecture.
6
7# Array representation (fallback)
8
9In this implementation of the cube.h interface, the cube is represented
10by two arrays of 8-bit unsigned integers, one for centers and one for
11corners. The 4 leas-significant digits of each bit determine the piece,
12the other 4 are used for orientation or kept to 0.
13
14Edges:
15 xxxopppp (x = unused, o = orientation, p = piece)
16
17Corners:
18 xooxpppp (x = unused, o = orientation, p = piece)
19
20The two bits for CO are shifted to make it possible to perform mod 3
21operations (sum, inverse) using only addition and bitwise operators.
22See below for details.
23
24The third bit is needed because x+y+1 can exceed 4.

Generated with cgit - Back to sebastiano.tronto.net