From c6496de6459206435417b86827f37c5ffcb1a9da Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 18 Aug 2018 17:40:54 +0200 Subject: [PATCH] increased MAX_EDGE to 12 (still have to cut memory for more normal geometries --- hyper.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/hyper.h b/hyper.h index aa2fc966..904ac67b 100644 --- a/hyper.h +++ b/hyper.h @@ -129,7 +129,6 @@ void addMessage(string s, char spamtype = 0); #define S28 (S7*4) #define S36 (S6*6) #define S84 (S7*S6*2) -#define MAX_EDGE 8 #define MAX_S3 4 #define MAX_S84 240 @@ -319,24 +318,31 @@ struct gcell { #define NOBARRIERS 15 #define MODFIXER 10090080 +#define MAX_EDGE 12 + template struct walker; template struct connection_table { - uint32_t spintable; + unsigned char spintable[6]; + unsigned short mirrortable; // neighbors; move[0] always goes towards origin, and then we go clockwise - T* move_table[8]; + T* move_table[MAX_EDGE]; T* full() { T* x; return (T*)((char*)this - ((char*)(&(x->c)) - (char*)x)); } - void setspin(int d, int spin, bool mirror) { spintable &= ~(15 << (d<<2)); spintable |= spin << (d<<2); spintable |= mirror << ((d<<2)+3); } + void setspin(int d, int spin, bool mirror) { + spintable[d>>1] &= ~(15 << ((d&1) << 2)); + spintable[d>>1] |= spin << ((d&1) << 2); + if(mirror) mirrortable |= (1 << d); + else mirrortable &=~ (1 << d); + } // we are spin(i)-th neighbor of move[i] - int spin(int d) { return (spintable >> (d<<2)) & 7; } - bool mirror(int d) { return (spintable >> ((d<<2)+3)) & 1; } + int spin(int d) { return (spintable[d>>1] >> ((d&1)<<2)) & 15; } + bool mirror(int d) { return (mirrortable >> d) & 1; } int fix(int d) { return (d + MODFIXER) % full()->degree(); } T*& modmove(int i) { return move(fix(i)); } T*& move(int i) { return move_table[i]; } unsigned char modspin(int i) { return spin(fix(i)); } void clear() { - spintable = 0; - for(int i=0; i<8; i++) move_table[i] = NULL; + for(int i=0; i