diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-27 12:04:53 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-27 12:04:53 +0200 |
| commit | 49b9c4a516f72e03d53277075f4580e2df8f0e63 (patch) | |
| tree | dea68649391d14d63a96e742b450c59681ac4305 /src/constants.h | |
| parent | fde8dfa9df8df1e3d42a9a8840836e33817cd498 (diff) | |
| download | nissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.tar.gz nissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.zip | |
Some type fixes and some cleanup
Diffstat (limited to '')
| -rw-r--r-- | src/constants.h | 214 |
1 files changed, 109 insertions, 105 deletions
diff --git a/src/constants.h b/src/constants.h index 00061bd..1a5453c 100644 --- a/src/constants.h +++ b/src/constants.h | |||
| @@ -1,9 +1,13 @@ | |||
| 1 | #define _2p11 2048U | 1 | #define _bit_u8(i) (UINT8_C(1) << (uint8_t)(i)) |
| 2 | #define _2p12 4096U | 2 | #define _bit_u32(i) (UINT32_C(1) << (uint32_t)(i)) |
| 3 | #define _3p7 2187U | 3 | #define _bit_u64(i) (UINT64_C(1) << (uint64_t)(i)) |
| 4 | #define _3p8 6561U | 4 | |
| 5 | #define _12c4 495U | 5 | #define _2p11 INT64_C(2048) |
| 6 | #define _8c4 70U | 6 | #define _2p12 INT64_C(4096) |
| 7 | #define _3p7 INT64_C(2187) | ||
| 8 | #define _3p8 INT64_C(6561) | ||
| 9 | #define _12c4 INT64_C(495) | ||
| 10 | #define _8c4 INT64_C(70) | ||
| 7 | 11 | ||
| 8 | _static int64_t binomial[12][12] = { | 12 | _static int64_t binomial[12][12] = { |
| 9 | {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 13 | {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
| @@ -20,111 +24,111 @@ _static int64_t binomial[12][12] = { | |||
| 20 | {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, | 24 | {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, |
| 21 | }; | 25 | }; |
| 22 | 26 | ||
| 23 | #define _move_U 0U | 27 | #define _move_U UINT8_C(0) |
| 24 | #define _move_U2 1U | 28 | #define _move_U2 UINT8_C(1) |
| 25 | #define _move_U3 2U | 29 | #define _move_U3 UINT8_C(2) |
| 26 | #define _move_D 3U | 30 | #define _move_D UINT8_C(3) |
| 27 | #define _move_D2 4U | 31 | #define _move_D2 UINT8_C(4) |
| 28 | #define _move_D3 5U | 32 | #define _move_D3 UINT8_C(5) |
| 29 | #define _move_R 6U | 33 | #define _move_R UINT8_C(6) |
| 30 | #define _move_R2 7U | 34 | #define _move_R2 UINT8_C(7) |
| 31 | #define _move_R3 8U | 35 | #define _move_R3 UINT8_C(8) |
| 32 | #define _move_L 9U | 36 | #define _move_L UINT8_C(9) |
| 33 | #define _move_L2 10U | 37 | #define _move_L2 UINT8_C(10) |
| 34 | #define _move_L3 11U | 38 | #define _move_L3 UINT8_C(11) |
| 35 | #define _move_F 12U | 39 | #define _move_F UINT8_C(12) |
| 36 | #define _move_F2 13U | 40 | #define _move_F2 UINT8_C(13) |
| 37 | #define _move_F3 14U | 41 | #define _move_F3 UINT8_C(14) |
| 38 | #define _move_B 15U | 42 | #define _move_B UINT8_C(15) |
| 39 | #define _move_B2 16U | 43 | #define _move_B2 UINT8_C(16) |
| 40 | #define _move_B3 17U | 44 | #define _move_B3 UINT8_C(17) |
| 41 | 45 | ||
| 42 | #define _trans_UFr 0 | 46 | #define _trans_UFr UINT8_C(0) |
| 43 | #define _trans_ULr 1 | 47 | #define _trans_ULr UINT8_C(1) |
| 44 | #define _trans_UBr 2 | 48 | #define _trans_UBr UINT8_C(2) |
| 45 | #define _trans_URr 3 | 49 | #define _trans_URr UINT8_C(3) |
| 46 | #define _trans_DFr 4 | 50 | #define _trans_DFr UINT8_C(4) |
| 47 | #define _trans_DLr 5 | 51 | #define _trans_DLr UINT8_C(5) |
| 48 | #define _trans_DBr 6 | 52 | #define _trans_DBr UINT8_C(6) |
| 49 | #define _trans_DRr 7 | 53 | #define _trans_DRr UINT8_C(7) |
| 50 | #define _trans_RUr 8 | 54 | #define _trans_RUr UINT8_C(8) |
| 51 | #define _trans_RFr 9 | 55 | #define _trans_RFr UINT8_C(9) |
| 52 | #define _trans_RDr 10 | 56 | #define _trans_RDr UINT8_C(10) |
| 53 | #define _trans_RBr 11 | 57 | #define _trans_RBr UINT8_C(11) |
| 54 | #define _trans_LUr 12 | 58 | #define _trans_LUr UINT8_C(12) |
| 55 | #define _trans_LFr 13 | 59 | #define _trans_LFr UINT8_C(13) |
| 56 | #define _trans_LDr 14 | 60 | #define _trans_LDr UINT8_C(14) |
| 57 | #define _trans_LBr 15 | 61 | #define _trans_LBr UINT8_C(15) |
| 58 | #define _trans_FUr 16 | 62 | #define _trans_FUr UINT8_C(16) |
| 59 | #define _trans_FRr 17 | 63 | #define _trans_FRr UINT8_C(17) |
| 60 | #define _trans_FDr 18 | 64 | #define _trans_FDr UINT8_C(18) |
| 61 | #define _trans_FLr 19 | 65 | #define _trans_FLr UINT8_C(19) |
| 62 | #define _trans_BUr 20 | 66 | #define _trans_BUr UINT8_C(20) |
| 63 | #define _trans_BRr 21 | 67 | #define _trans_BRr UINT8_C(21) |
| 64 | #define _trans_BDr 22 | 68 | #define _trans_BDr UINT8_C(22) |
| 65 | #define _trans_BLr 23 | 69 | #define _trans_BLr UINT8_C(23) |
| 66 | 70 | ||
| 67 | #define _trans_UFm 24 | 71 | #define _trans_UFm UINT8_C(24) |
| 68 | #define _trans_ULm 25 | 72 | #define _trans_ULm UINT8_C(25) |
| 69 | #define _trans_UBm 26 | 73 | #define _trans_UBm UINT8_C(26) |
| 70 | #define _trans_URm 27 | 74 | #define _trans_URm UINT8_C(27) |
| 71 | #define _trans_DFm 28 | 75 | #define _trans_DFm UINT8_C(28) |
| 72 | #define _trans_DLm 29 | 76 | #define _trans_DLm UINT8_C(29) |
| 73 | #define _trans_DBm 30 | 77 | #define _trans_DBm UINT8_C(30) |
| 74 | #define _trans_DRm 31 | 78 | #define _trans_DRm UINT8_C(31) |
| 75 | #define _trans_RUm 32 | 79 | #define _trans_RUm UINT8_C(32) |
| 76 | #define _trans_RFm 33 | 80 | #define _trans_RFm UINT8_C(33) |
| 77 | #define _trans_RDm 34 | 81 | #define _trans_RDm UINT8_C(34) |
| 78 | #define _trans_RBm 35 | 82 | #define _trans_RBm UINT8_C(35) |
| 79 | #define _trans_LUm 36 | 83 | #define _trans_LUm UINT8_C(36) |
| 80 | #define _trans_LFm 37 | 84 | #define _trans_LFm UINT8_C(37) |
| 81 | #define _trans_LDm 38 | 85 | #define _trans_LDm UINT8_C(38) |
| 82 | #define _trans_LBm 39 | 86 | #define _trans_LBm UINT8_C(39) |
| 83 | #define _trans_FUm 40 | 87 | #define _trans_FUm UINT8_C(40) |
| 84 | #define _trans_FRm 41 | 88 | #define _trans_FRm UINT8_C(41) |
| 85 | #define _trans_FDm 42 | 89 | #define _trans_FDm UINT8_C(42) |
| 86 | #define _trans_FLm 43 | 90 | #define _trans_FLm UINT8_C(43) |
| 87 | #define _trans_BUm 44 | 91 | #define _trans_BUm UINT8_C(44) |
| 88 | #define _trans_BRm 45 | 92 | #define _trans_BRm UINT8_C(45) |
| 89 | #define _trans_BDm 46 | 93 | #define _trans_BDm UINT8_C(46) |
| 90 | #define _trans_BLm 47 | 94 | #define _trans_BLm UINT8_C(47) |
| 91 | 95 | ||
| 92 | #define _c_ufr 0U | 96 | #define _c_ufr UINT8_C(0) |
| 93 | #define _c_ubl 1U | 97 | #define _c_ubl UINT8_C(1) |
| 94 | #define _c_dfl 2U | 98 | #define _c_dfl UINT8_C(2) |
| 95 | #define _c_dbr 3U | 99 | #define _c_dbr UINT8_C(3) |
| 96 | #define _c_ufl 4U | 100 | #define _c_ufl UINT8_C(4) |
| 97 | #define _c_ubr 5U | 101 | #define _c_ubr UINT8_C(5) |
| 98 | #define _c_dfr 6U | 102 | #define _c_dfr UINT8_C(6) |
| 99 | #define _c_dbl 7U | 103 | #define _c_dbl UINT8_C(7) |
| 100 | 104 | ||
| 101 | #define _e_uf 0U | 105 | #define _e_uf UINT8_C(0) |
| 102 | #define _e_ub 1U | 106 | #define _e_ub UINT8_C(1) |
| 103 | #define _e_db 2U | 107 | #define _e_db UINT8_C(2) |
| 104 | #define _e_df 3U | 108 | #define _e_df UINT8_C(3) |
| 105 | #define _e_ur 4U | 109 | #define _e_ur UINT8_C(4) |
| 106 | #define _e_ul 5U | 110 | #define _e_ul UINT8_C(5) |
| 107 | #define _e_dl 6U | 111 | #define _e_dl UINT8_C(6) |
| 108 | #define _e_dr 7U | 112 | #define _e_dr UINT8_C(7) |
| 109 | #define _e_fr 8U | 113 | #define _e_fr UINT8_C(8) |
| 110 | #define _e_fl 9U | 114 | #define _e_fl UINT8_C(9) |
| 111 | #define _e_bl 10U | 115 | #define _e_bl UINT8_C(10) |
| 112 | #define _e_br 11U | 116 | #define _e_br UINT8_C(11) |
| 113 | 117 | ||
| 114 | #define _eoshift 4U | 118 | #define _eoshift UINT8_C(4) |
| 115 | #define _coshift 5U | 119 | #define _coshift UINT8_C(5) |
| 116 | 120 | ||
| 117 | #define _pbits 0xFU | 121 | #define _pbits UINT8_C(0xF) |
| 118 | #define _esepbit1 0x4U | 122 | #define _esepbit1 UINT8_C(0x4) |
| 119 | #define _esepbit2 0x8U | 123 | #define _esepbit2 UINT8_C(0x8) |
| 120 | #define _csepbit 0x4U | 124 | #define _csepbit UINT8_C(0x4) |
| 121 | #define _eobit 0x10U | 125 | #define _eobit UINT8_C(0x10) |
| 122 | #define _cobits 0xF0U | 126 | #define _cobits UINT8_C(0xF0) |
| 123 | #define _cobits2 0x60U | 127 | #define _cobits2 UINT8_C(0x60) |
| 124 | #define _ctwist_cw 0x20U | 128 | #define _ctwist_cw UINT8_C(0x20) |
| 125 | #define _ctwist_ccw 0x40U | 129 | #define _ctwist_ccw UINT8_C(0x40) |
| 126 | #define _eflip 0x10U | 130 | #define _eflip UINT8_C(0x10) |
| 127 | #define _error 0xFFU | 131 | #define _error UINT8_C(0xFF) |
| 128 | 132 | ||
| 129 | _static cube_t zero = { .corner = {0}, .edge = {0} }; | 133 | _static cube_t zero = { .corner = {0}, .edge = {0} }; |
| 130 | _static cube_t solved = { | 134 | _static cube_t solved = { |
