Fix Windows compiler warnings

这个提交包含在:
Douglas Stebila 2019-04-14 20:50:16 -04:00
父节点 5b733ede1c
当前提交 2927f42c59
共有 2 个文件被更改,包括 28 次插入28 次删除

查看文件

@ -5,17 +5,17 @@ void PQCLEAN_NTRUHPS4096821_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *
int i;
for (i = 0; i < NTRU_PACK_DEG / 2; i++) {
r[3 * i + 0] = a->coeffs[2 * i + 0] & 0xff;
r[3 * i + 1] = (a->coeffs[2 * i + 0] >> 8) | ((a->coeffs[2 * i + 1] & 0x0f) << 4);
r[3 * i + 2] = (a->coeffs[2 * i + 1] >> 4);
r[3 * i + 0] = (unsigned char) ( a->coeffs[2 * i + 0] & 0xff);
r[3 * i + 1] = (unsigned char) ((a->coeffs[2 * i + 0] >> 8) | ((a->coeffs[2 * i + 1] & 0x0f) << 4));
r[3 * i + 2] = (unsigned char) ((a->coeffs[2 * i + 1] >> 4));
}
}
void PQCLEAN_NTRUHPS4096821_CLEAN_poly_Sq_frombytes(poly *r, const unsigned char *a) {
int i;
for (i = 0; i < NTRU_PACK_DEG / 2; i++) {
r->coeffs[2 * i + 0] = (a[3 * i + 0] >> 0) | (((uint16_t)a[3 * i + 1] & 0x0f) << 8);
r->coeffs[2 * i + 1] = (a[3 * i + 1] >> 4) | (((uint16_t)a[3 * i + 2] & 0xff) << 4);
r->coeffs[2 * i + 0] = (unsigned char) ((a[3 * i + 0] >> 0) | (((uint16_t)a[3 * i + 1] & 0x0f) << 8));
r->coeffs[2 * i + 1] = (unsigned char) ((a[3 * i + 1] >> 4) | (((uint16_t)a[3 * i + 2] & 0xff) << 4));
}
}

查看文件

@ -10,19 +10,19 @@ void PQCLEAN_NTRUHRSS701_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *a)
t[j] = a->coeffs[8 * i + j];
}
r[13 * i + 0] = t[0] & 0xff;
r[13 * i + 1] = (t[0] >> 8) | ((t[1] & 0x07) << 5);
r[13 * i + 2] = (t[1] >> 3) & 0xff;
r[13 * i + 3] = (t[1] >> 11) | ((t[2] & 0x3f) << 2);
r[13 * i + 4] = (t[2] >> 6) | ((t[3] & 0x01) << 7);
r[13 * i + 5] = (t[3] >> 1) & 0xff;
r[13 * i + 6] = (t[3] >> 9) | ((t[4] & 0x0f) << 4);
r[13 * i + 7] = (t[4] >> 4) & 0xff;
r[13 * i + 8] = (t[4] >> 12) | ((t[5] & 0x7f) << 1);
r[13 * i + 9] = (t[5] >> 7) | ((t[6] & 0x03) << 6);
r[13 * i + 10] = (t[6] >> 2) & 0xff;
r[13 * i + 11] = (t[6] >> 10) | ((t[7] & 0x1f) << 3);
r[13 * i + 12] = (t[7] >> 5);
r[13 * i + 0] = (unsigned char) ( t[0] & 0xff);
r[13 * i + 1] = (unsigned char) ((t[0] >> 8) | ((t[1] & 0x07) << 5));
r[13 * i + 2] = (unsigned char) ((t[1] >> 3) & 0xff);
r[13 * i + 3] = (unsigned char) ((t[1] >> 11) | ((t[2] & 0x3f) << 2));
r[13 * i + 4] = (unsigned char) ((t[2] >> 6) | ((t[3] & 0x01) << 7));
r[13 * i + 5] = (unsigned char) ((t[3] >> 1) & 0xff);
r[13 * i + 6] = (unsigned char) ((t[3] >> 9) | ((t[4] & 0x0f) << 4));
r[13 * i + 7] = (unsigned char) ((t[4] >> 4) & 0xff);
r[13 * i + 8] = (unsigned char) ((t[4] >> 12) | ((t[5] & 0x7f) << 1));
r[13 * i + 9] = (unsigned char) ((t[5] >> 7) | ((t[6] & 0x03) << 6));
r[13 * i + 10] = (unsigned char) ((t[6] >> 2) & 0xff);
r[13 * i + 11] = (unsigned char) ((t[6] >> 10) | ((t[7] & 0x1f) << 3));
r[13 * i + 12] = (unsigned char) ((t[7] >> 5));
}
for (j = 0; j < NTRU_PACK_DEG - 8 * i; j++) {
@ -34,20 +34,20 @@ void PQCLEAN_NTRUHRSS701_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *a)
switch (NTRU_PACK_DEG - 8 * (NTRU_PACK_DEG / 8)) {
case 6:
r[13 * i + 9] = (t[5] >> 7) | ((t[6] & 0x03) << 6);
r[13 * i + 8] = (t[4] >> 12) | ((t[5] & 0x7f) << 1);
r[13 * i + 7] = (t[4] >> 4) & 0xff;
r[13 * i + 9] = (unsigned char) ((t[5] >> 7) | ((t[6] & 0x03) << 6));
r[13 * i + 8] = (unsigned char) ((t[4] >> 12) | ((t[5] & 0x7f) << 1));
r[13 * i + 7] = (unsigned char) ((t[4] >> 4) & 0xff);
// fallthrough
case 4:
r[13 * i + 6] = (t[3] >> 9) | ((t[4] & 0x0f) << 4);
r[13 * i + 5] = (t[3] >> 1) & 0xff;
r[13 * i + 4] = (t[2] >> 6) | ((t[3] & 0x01) << 7);
r[13 * i + 6] = (unsigned char) ((t[3] >> 9) | ((t[4] & 0x0f) << 4));
r[13 * i + 5] = (unsigned char) ((t[3] >> 1) & 0xff);
r[13 * i + 4] = (unsigned char) ((t[2] >> 6) | ((t[3] & 0x01) << 7));
// fallthrough
case 2:
r[13 * i + 3] = (t[1] >> 11) | ((t[2] & 0x3f) << 2);
r[13 * i + 2] = (t[1] >> 3) & 0xff;
r[13 * i + 1] = (t[0] >> 8) | ((t[1] & 0x07) << 5);
r[13 * i + 0] = t[0] & 0xff;
r[13 * i + 3] = (unsigned char) ((t[1] >> 11) | ((t[2] & 0x3f) << 2));
r[13 * i + 2] = (unsigned char) ((t[1] >> 3) & 0xff);
r[13 * i + 1] = (unsigned char) ((t[0] >> 8) | ((t[1] & 0x07) << 5));
r[13 * i + 0] = (unsigned char) ( t[0] & 0xff);
}
}