1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-26 09:21:28 +00:00

NTRU Prime: More changes for MS compiler

This commit is contained in:
John M. Schanck 2020-09-01 15:16:45 -04:00
parent bfd9e1e8fd
commit 4c5a8326ef
40 changed files with 52 additions and 52 deletions

View File

@ -282,5 +282,5 @@ void PQCLEAN_NTRULPR653_AVX2_crypto_encode_653x1541(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -284,5 +284,5 @@ void PQCLEAN_NTRULPR653_AVX2_crypto_encode_653x1541round(unsigned char *out, con
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -123,5 +123,5 @@ void PQCLEAN_NTRULPR653_CLEAN_crypto_encode_653x1541(unsigned char *out, const v
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -297,5 +297,5 @@ void PQCLEAN_NTRULPR761_AVX2_crypto_encode_761x1531(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -299,5 +299,5 @@ void PQCLEAN_NTRULPR761_AVX2_crypto_encode_761x1531round(unsigned char *out, con
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -115,5 +115,5 @@ void PQCLEAN_NTRULPR761_CLEAN_crypto_encode_761x1531(unsigned char *out, const v
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -279,5 +279,5 @@ void PQCLEAN_NTRULPR857_AVX2_crypto_encode_857x1723(unsigned char *out, const vo
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -281,5 +281,5 @@ void PQCLEAN_NTRULPR857_AVX2_crypto_encode_857x1723round(unsigned char *out, con
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -126,5 +126,5 @@ void PQCLEAN_NTRULPR857_CLEAN_crypto_encode_857x1723(unsigned char *out, const v
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -48,7 +48,7 @@ static Fq Fq_bigfreeze(uint32 x) {
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= (uint32) (q * ((x * (uint64)q31) >> 31));
x -= q;
x += (-(x >> 31)) & (uint32)q;
x += (~(x >> 31) + 1) & (uint32)q;
return (Fq) x;
}

View File

@ -282,5 +282,5 @@ void PQCLEAN_SNTRUP653_AVX2_crypto_encode_653x1541(unsigned char *out, const voi
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -284,5 +284,5 @@ void PQCLEAN_SNTRUP653_AVX2_crypto_encode_653x1541round(unsigned char *out, cons
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -58,7 +58,7 @@ void PQCLEAN_SNTRUP653_AVX2_crypto_encode_653x4621(unsigned char *out, const voi
writing += 16;
out += 32;
}
R[326] = ((R0[652] + 2310) & 16383);
R[326] = (uint16) (((R0[652] + 2310) & 16383));
reading = (uint16 *) R;
writing = R;
@ -284,5 +284,5 @@ void PQCLEAN_SNTRUP653_AVX2_crypto_encode_653x4621(unsigned char *out, const voi
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -123,5 +123,5 @@ void PQCLEAN_SNTRUP653_CLEAN_crypto_encode_653x1541(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -15,8 +15,8 @@ void PQCLEAN_SNTRUP653_CLEAN_crypto_encode_653x4621(unsigned char *out, const vo
uint32 r2;
for (i = 0; i < 326; ++i) {
r0 = (R0[2 * i] + 2310) & 16383;
r1 = (R0[2 * i + 1] + 2310) & 16383;
r0 = (uint16) ((R0[2 * i] + 2310) & 16383);
r1 = (uint16) ((R0[2 * i + 1] + 2310) & 16383);
r2 = r0 + r1 * (uint32)4621;
*out++ = (unsigned char) r2;
r2 >>= 8;
@ -24,7 +24,7 @@ void PQCLEAN_SNTRUP653_CLEAN_crypto_encode_653x4621(unsigned char *out, const vo
r2 >>= 8;
R[i] = (uint16) r2;
}
R[326] = (R0[652] + 2310) & 16383;
R[326] = (uint16) ((R0[652] + 2310) & 16383);
for (i = 0; i < 163; ++i) {
r0 = R[2 * i];
@ -123,5 +123,5 @@ void PQCLEAN_SNTRUP653_CLEAN_crypto_encode_653x4621(unsigned char *out, const vo
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -297,5 +297,5 @@ void PQCLEAN_SNTRUP761_AVX2_crypto_encode_761x1531(unsigned char *out, const voi
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -299,5 +299,5 @@ void PQCLEAN_SNTRUP761_AVX2_crypto_encode_761x1531round(unsigned char *out, cons
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -58,7 +58,7 @@ void PQCLEAN_SNTRUP761_AVX2_crypto_encode_761x4591(unsigned char *out, const voi
writing += 16;
out += 32;
}
R[380] = ((R0[760] + 2295) & 16383);
R[380] = (uint16) (((R0[760] + 2295) & 16383));
reading = (uint16 *) R;
writing = R;
@ -304,5 +304,5 @@ void PQCLEAN_SNTRUP761_AVX2_crypto_encode_761x4591(unsigned char *out, const voi
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -115,5 +115,5 @@ void PQCLEAN_SNTRUP761_CLEAN_crypto_encode_761x1531(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -15,8 +15,8 @@ void PQCLEAN_SNTRUP761_CLEAN_crypto_encode_761x4591(unsigned char *out, const vo
uint32 r2;
for (i = 0; i < 380; ++i) {
r0 = (R0[2 * i] + 2295) & 16383;
r1 = (R0[2 * i + 1] + 2295) & 16383;
r0 = (uint16) ((R0[2 * i] + 2295) & 16383);
r1 = (uint16) ((R0[2 * i + 1] + 2295) & 16383);
r2 = r0 + r1 * (uint32)4591;
*out++ = (unsigned char) r2;
r2 >>= 8;
@ -24,7 +24,7 @@ void PQCLEAN_SNTRUP761_CLEAN_crypto_encode_761x4591(unsigned char *out, const vo
r2 >>= 8;
R[i] = (uint16) r2;
}
R[380] = (R0[760] + 2295) & 16383;
R[380] = (uint16) ((R0[760] + 2295) & 16383);
for (i = 0; i < 190; ++i) {
r0 = R[2 * i];
@ -143,5 +143,5 @@ void PQCLEAN_SNTRUP761_CLEAN_crypto_encode_761x4591(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -112,7 +112,7 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_decode_857x5167(void *v, const unsigned char
a2 = a0 = R9[i];
a0 = mulhi(a0, -28) - mulhi(mullo(a0, -886), 74); /* -44...37 */
a0 += (a0 >> 15) & 74; /* 0...73 */
a1 = (int16) (a2 - a0) >> 1;
a1 = (int16) ((a2 - a0) >> 1);
a1 = mullo(a1, 7085);
/* invalid inputs might need reduction mod 74 */

View File

@ -279,5 +279,5 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_encode_857x1723(unsigned char *out, const voi
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -281,5 +281,5 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_encode_857x1723round(unsigned char *out, cons
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -58,7 +58,7 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_encode_857x5167(unsigned char *out, const voi
writing += 16;
out += 32;
}
R[428] = ((R0[856] + 2583) & 16383);
R[428] = (uint16) (((R0[856] + 2583) & 16383));
reading = (uint16 *) R;
writing = R;
@ -327,5 +327,5 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_encode_857x5167(unsigned char *out, const voi
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -54,7 +54,7 @@ static void uint32_divmod_uint14(uint32 *q, uint16 *r, uint32 x, uint16 m) {
x -= m;
*q += 1;
mask = -(x >> 31);
mask = (~(x >> 31) + 1);
x += mask & (uint32)m;
*q += mask;
/* x < m */

View File

@ -126,5 +126,5 @@ void PQCLEAN_SNTRUP857_CLEAN_crypto_encode_857x1723(unsigned char *out, const vo
R[0] = (uint16) r2;
r0 = R[0];
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}

View File

@ -15,8 +15,8 @@ void PQCLEAN_SNTRUP857_CLEAN_crypto_encode_857x5167(unsigned char *out, const vo
uint32 r2;
for (i = 0; i < 428; ++i) {
r0 = (R0[2 * i] + 2583) & 16383;
r1 = (R0[2 * i + 1] + 2583) & 16383;
r0 = (uint16) ((R0[2 * i] + 2583) & 16383);
r1 = (uint16) ((R0[2 * i + 1] + 2583) & 16383);
r2 = r0 + r1 * (uint32)5167;
*out++ = (unsigned char) r2;
r2 >>= 8;
@ -24,7 +24,7 @@ void PQCLEAN_SNTRUP857_CLEAN_crypto_encode_857x5167(unsigned char *out, const vo
r2 >>= 8;
R[i] = (uint16) r2;
}
R[428] = (R0[856] + 2583) & 16383;
R[428] = (uint16) ((R0[856] + 2583) & 16383);
for (i = 0; i < 214; ++i) {
r0 = R[2 * i];
@ -134,5 +134,5 @@ void PQCLEAN_SNTRUP857_CLEAN_crypto_encode_857x5167(unsigned char *out, const vo
r0 = R[0];
*out++ = (unsigned char) r0;
r0 >>= 8;
*out++ = (unsigned char) r0; /*clang-analyzer-deadcode.DeadStores*/ /*r0 >>= 8;*/
*out++ = (unsigned char) r0;
}