| 4167 | |
| 4168 | |
| 4169 | void CellEngine::n_spinsheat() |
| 4170 | { |
| 4171 | long bonds; |
| 4172 | long heat; |
| 4173 | long error = 0; |
| 4174 | |
| 4175 | #define SPINSHEAT ( \ |
| 4176 | (error += SUM8REG(0x7f) + frob), \ |
| 4177 | (error = ((error < 0) \ |
| 4178 | ? 0 \ |
| 4179 | : ((error > (0x7f << 3)) \ |
| 4180 | ? (0x7f << 3) \ |
| 4181 | : error))), \ |
| 4182 | (c = (((error >> 3) & 0x7f) | (c & 0x80))), \ |
| 4183 | (error &= 0x07), \ |
| 4184 | (unsigned char)((((xx + x) ^ (yy + y) ^ phase) & 1) /* spatio-temporal phase */ \ |
| 4185 | ? c /* stay the same if true */ \ |
| 4186 | : ((bonds = (SUM4REG(0x80) >> 7)), \ |
| 4187 | (bonds = ((c & 0x80) /* if center then subtract from 4 */ \ |
| 4188 | ? (4 - bonds) \ |
| 4189 | : (bonds))), \ |
| 4190 | (heat = (c & 0x7f)), \ |
| 4191 | (((bonds == 0) || /* case 0, 4 */ \ |
| 4192 | (bonds == 4)) \ |
| 4193 | ? c /* xor with 0 */ \ |
| 4194 | : ((bonds == 2) /* case 2 */ \ |
| 4195 | ? (c ^ 0x80) /* xor with 1 */ \ |
| 4196 | : ((bonds == 1) /* case 1 */ \ |
| 4197 | ? (((heat >= low) && \ |
| 4198 | (heat >= inflation)) /* can we get from bank? */ \ |
| 4199 | ? c /* xor with 0 */ \ |
| 4200 | : ((c ^ 0x80) - inflation) /* flip and debit */ \ |
| 4201 | ) \ |
| 4202 | : (((heat <= high) && \ |
| 4203 | (heat < 0x80 - inflation)) /* can we put to bank? */ \ |
| 4204 | ? ((c ^ 0x80) + inflation) /* flip and credit */ \ |
| 4205 | : c /* xor with 0 */ \ |
| 4206 | ) \ |
| 4207 | ) \ |
| 4208 | ) \ |
| 4209 | ) \ |
| 4210 | ) \ |
| 4211 | ) \ |
| 4212 | ) |
| 4213 | |
| 4214 | CAM_MASKED_REG_LOOP(SPINSHEAT) |
| 4215 | } |
| 4216 | |
| 4217 | |
| 4218 | void CellEngine::n_spinglass() |
nothing calls this directly
no outgoing calls
no test coverage detected