MCPcopy Create free account
hub / github.com/SimHacker/micropolis / n_margolis

Method n_margolis

MicropolisCore/src/CellEngine/src/cellengine.cpp:1658–1716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1656
1657
1658void CellEngine::n_margolis()
1659{
1660 if (rule == NULL) return;
1661
1662 register Byte i;
1663
1664 // 0 1 2 3 4 5 6 7 8 9
1665 // c c' cw ccw opp cw' ccw' opp'
1666 // 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200
1667
1668#define MARGOLIS_ODD ( \
1669 /* c c' */ \
1670 (c & 3) | \
1671 /* cw cw' */ \
1672 (i = ((xx & 1) ? ((yy & 1) ? (e & 3) : (n & 3)) \
1673 : ((yy & 1) ? (s & 3) : (w & 3))), \
1674 (((i & 1) << 2) | ((i & 2) << 4))) | \
1675 /* ccw ccw' */ \
1676 (i = ((xx & 1) ? ((yy & 1) ? (s & 3) : (e & 3)) \
1677 : ((yy & 1) ? (w & 3) : (n & 3))), \
1678 (((i & 1) << 3) | ((i & 2) << 5))) | \
1679 /* opp opp' */ \
1680 (i = ((xx & 1) ? ((yy & 1) ? (se & 3) : (ne & 3)) \
1681 : ((yy & 1) ? (sw & 3) : (nw & 3))), \
1682 (((i & 1) << 4) | ((i & 2) << 6))))
1683
1684#define MARGOLIS_EVEN ( \
1685 /* c c' */ \
1686 (c & 3) | \
1687 /* cw cw' */ \
1688 (i = ((xx & 1) ? ((yy & 1) ? (w & 3) : (s & 3)) \
1689 : ((yy & 1) ? (n & 3) : (e & 3))), \
1690 (((i & 1) << 2) | ((i & 2) << 4))) | \
1691 /* ccw ccw' */ \
1692 (i = ((xx & 1) ? ((yy & 1) ? (n & 3) : (w & 3)) \
1693 : ((yy & 1) ? (e & 3) : (s & 3))), \
1694 (((i & 1) << 3) | ((i & 2) << 5))) | \
1695 /* opp opp' */ \
1696 (i = ((xx & 1) ? ((yy & 1) ? (nw & 3) : (sw & 3)) \
1697 : ((yy & 1) ? (ne & 3) : (se & 3))), \
1698 (((i & 1) << 4) | ((i & 2) << 6))))
1699
1700 if (inflation) {
1701 int last = 0;
1702 int heat = 0;
1703
1704 if (phase) {
1705 CAM_MASKED_REG_TABLE_HEAT6_LOOP(MARGOLIS_ODD)
1706 } else {
1707 CAM_MASKED_REG_TABLE_HEAT6_LOOP(MARGOLIS_EVEN)
1708 }
1709 } else {
1710 if (phase) {
1711 CAM_MASKED_REG_TABLE_LOOP(MARGOLIS_ODD)
1712 } else {
1713 CAM_MASKED_REG_TABLE_LOOP(MARGOLIS_EVEN)
1714 }
1715 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected