nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

constants.h (1280B)


      1 #define UINT8_BIT(i) (UINT8_C(1) << (uint8_t)(i))
      2 
      3 #define FACTORIAL_MAX UINT64_C(12)
      4 
      5 #define POW_2_11   UINT64_C(2048)
      6 #define POW_3_7    UINT64_C(2187)
      7 #define FACT_12    UINT64_C(479001600)
      8 #define FACT_8     UINT64_C(40320)
      9 #define FACT_4     UINT64_C(24)
     10 #define COMB_12_4  UINT64_C(495)
     11 #define COMB_8_4   UINT64_C(70)
     12 
     13 #define UINT8_ERROR UINT8_MAX
     14 
     15 STATIC uint64_t factorial[FACTORIAL_MAX+1] = {
     16 	[0] = 1,
     17 	[1] = 1,
     18 	[2] = 2,
     19 	[3] = 6,
     20 	[4] = 24,
     21 	[5] = 120,
     22 	[6] = 720,
     23 	[7] = 5040,
     24 	[8] = 40320,
     25 	[9] = 362880,
     26 	[10] = 3628800,
     27 	[11] = 39916800,
     28 	[12] = 479001600,
     29 };
     30 
     31 STATIC uint64_t binomial[12][12] = {
     32 	{1,  0,  0,   0,   0,   0,   0,   0,   0,  0,  0, 0},
     33 	{1,  1,  0,   0,   0,   0,   0,   0,   0,  0,  0, 0},
     34 	{1,  2,  1,   0,   0,   0,   0,   0,   0,  0,  0, 0},
     35 	{1,  3,  3,   1,   0,   0,   0,   0,   0,  0,  0, 0},
     36 	{1,  4,  6,   4,   1,   0,   0,   0,   0,  0,  0, 0},
     37 	{1,  5, 10,  10,   5,   1,   0,   0,   0,  0,  0, 0},
     38 	{1,  6, 15,  20,  15,   6,   1,   0,   0,  0,  0, 0},
     39 	{1,  7, 21,  35,  35,  21,   7,   1,   0,  0,  0, 0},
     40 	{1,  8, 28,  56,  70,  56,  28,   8,   1,  0,  0, 0},
     41 	{1,  9, 36,  84, 126, 126,  84,  36,   9,  1,  0, 0},
     42 	{1, 10, 45, 120, 210, 252, 210, 120,  45, 10,  1, 0},
     43 	{1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1},
     44 };