equal
deleted
inserted
replaced
145 uint32_t product = 0; |
145 uint32_t product = 0; |
146 uint32_t b_pow_x_table[D + 1]; // b_pow_x_table[k] = (b * x**k) mod P |
146 uint32_t b_pow_x_table[D + 1]; // b_pow_x_table[k] = (b * x**k) mod P |
147 b_pow_x_table[0] = b; |
147 b_pow_x_table[0] = b; |
148 for (int k = 0; k < D; ++k) { |
148 for (int k = 0; k < D; ++k) { |
149 // If "a" has non-zero coefficient at x**k,/ add ((b * x**k) mod P) to the result. |
149 // If "a" has non-zero coefficient at x**k,/ add ((b * x**k) mod P) to the result. |
150 if ((a & (uint64_t)(1 << (D - 1 - k))) != 0) product ^= b_pow_x_table[k]; |
150 if ((a & (((uint32_t)1) << (D - 1 - k))) != 0) product ^= b_pow_x_table[k]; |
151 |
151 |
152 // Compute b_pow_x_table[k+1] = (b ** x**(k+1)) mod P. |
152 // Compute b_pow_x_table[k+1] = (b ** x**(k+1)) mod P. |
153 if (b_pow_x_table[k] & 1) { |
153 if (b_pow_x_table[k] & 1) { |
154 // If degree of (b_pow_x_table[k] * x) is D, then |
154 // If degree of (b_pow_x_table[k] * x) is D, then |
155 // degree of (b_pow_x_table[k] * x - P) is less than D. |
155 // degree of (b_pow_x_table[k] * x - P) is less than D. |