| 912 | #pragma option_override(init_perm, "opt(level, 0)") |
| 913 | #endif |
| 914 | STATIC void |
| 915 | init_perm(C_block perm[64 / CHUNKBITS][1 << CHUNKBITS], |
| 916 | const unsigned char p[64], int chars_out) |
| 917 | { |
| 918 | for (int k = 0; k < chars_out * 8; k++) |
| 919 | { |
| 920 | // each output bit position |
| 921 | int l = p[k] - 1; // where this bit comes from |
| 922 | if (l < 0) |
| 923 | continue; // output bit is always 0 |
| 924 | const int i = l >> LGCHUNKBITS; // which chunk this bit comes from |
| 925 | l = 1 << (l & (CHUNKBITS - 1)); // mask for this bit |
| 926 | for (int j = 0; j < (1 << CHUNKBITS); j++) |
| 927 | { |
| 928 | // each chunk value |
| 929 | if ((j & l) != 0) |
| 930 | perm[i][j].b[k >> 3] |= 1 << (k & 07); |
| 931 | } |
| 932 | } |
| 933 | } |