Home | History | Annotate | Download | only in INPUTS
      1 #define EXPAND_2_CASES(i, x, y)    CASE(i, x, y);             CASE(i + 1, x, y);
      2 #define EXPAND_4_CASES(i, x, y)    EXPAND_2_CASES(i, x, y)    EXPAND_2_CASES(i + 2, x, y)
      3 #define EXPAND_8_CASES(i, x, y)    EXPAND_4_CASES(i, x, y)    EXPAND_4_CASES(i + 4, x, y)
      4 #define EXPAND_16_CASES(i, x, y)   EXPAND_8_CASES(i, x, y)    EXPAND_8_CASES(i + 8, x, y)
      5 #define EXPAND_32_CASES(i, x, y)   EXPAND_16_CASES(i, x, y)   EXPAND_16_CASES(i + 16, x, y)
      6 #define EXPAND_64_CASES(i, x, y)   EXPAND_32_CASES(i, x, y)   EXPAND_32_CASES(i + 32, x, y)
      7 #define EXPAND_128_CASES(i, x, y)  EXPAND_64_CASES(i, x, y)   EXPAND_64_CASES(i + 64, x, y)
      8 #define EXPAND_256_CASES(i, x, y)  EXPAND_128_CASES(i, x, y)  EXPAND_128_CASES(i + 128, x, y)
      9 #define EXPAND_512_CASES(i, x, y)  EXPAND_256_CASES(i, x, y)  EXPAND_256_CASES(i + 256, x, y)
     10 #define EXPAND_1024_CASES(i, x, y) EXPAND_512_CASES(i, x, y)  EXPAND_512_CASES(i + 512, x, y)
     11 #define EXPAND_2048_CASES(i, x, y) EXPAND_1024_CASES(i, x, y) EXPAND_1024_CASES(i + 1024, x, y)
     12 #define EXPAND_4096_CASES(i, x, y) EXPAND_2048_CASES(i, x, y) EXPAND_2048_CASES(i + 2048, x, y)
     13 
     14 // This has a *monstrous* single fan-out in the CFG, across 8000 blocks inside
     15 // the while loop.
     16 unsigned cfg_big_switch(int x) {
     17   unsigned y = 0;
     18   while (x > 0) {
     19     switch(x) {
     20 #define CASE(i, x, y) \
     21       case i: { int case_var = 3*x + i; y += case_var - 1; break; }
     22 EXPAND_4096_CASES(0, x, y);
     23     }
     24     --x;
     25   }
     26   return y;
     27 }
     28