diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/coord.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/coord.c b/src/coord.c index 8c978bc..a53dacc 100644 --- a/src/coord.c +++ b/src/coord.c | |||
| @@ -153,7 +153,13 @@ coord_drud_eofb = { | |||
| 153 | static Cube | 153 | static Cube |
| 154 | antindex_eofb(uint64_t ind) | 154 | antindex_eofb(uint64_t ind) |
| 155 | { | 155 | { |
| 156 | return (Cube){ .eofb = ind, .eorl = ind, .eoud = ind }; | 156 | Cube ret = {0}; |
| 157 | |||
| 158 | ret.eofb = ind; | ||
| 159 | ret.eorl = ind; | ||
| 160 | ret.eoud = ind; | ||
| 161 | |||
| 162 | return ret; | ||
| 157 | } | 163 | } |
| 158 | 164 | ||
| 159 | static Cube | 165 | static Cube |
| @@ -161,8 +167,29 @@ antindex_eofbepos(uint64_t ind) | |||
| 161 | { | 167 | { |
| 162 | Cube ret = {0}; | 168 | Cube ret = {0}; |
| 163 | 169 | ||
| 170 | /* We need eorl for sym16 coordinate */ | ||
| 171 | static int initialized = false; | ||
| 172 | static uint64_t eorl_aux[POW2TO11][BINOM12ON4]; | ||
| 173 | static int eo_aux[12], ep_aux[12]; | ||
| 174 | unsigned int i, j, k; | ||
| 175 | |||
| 176 | if (!initialized) { | ||
| 177 | for (i = 0; i < POW2TO11; i++) { | ||
| 178 | for (j = 0; j < BINOM12ON4; j++) { | ||
| 179 | int_to_sum_zero_array(i, 2, 12, eo_aux); | ||
| 180 | index_to_subset(j, 12, 4, ep_aux); | ||
| 181 | for (k = 0; k < 12; k++) | ||
| 182 | if (ep_aux[k]) | ||
| 183 | eo_aux[k] = 1 - eo_aux[k]; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | initialized = true; | ||
| 188 | } | ||
| 189 | |||
| 164 | ret.eofb = ind % POW2TO11; | 190 | ret.eofb = ind % POW2TO11; |
| 165 | ret.epose = (ind / POW2TO11) * 24; | 191 | ret.epose = (ind / POW2TO11) * 24; |
| 192 | ret.eorl = eorl_aux[ret.eofb][ret.epose/24]; | ||
| 166 | 193 | ||
| 167 | return ret; | 194 | return ret; |
| 168 | } | 195 | } |
