1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 15:39:07 +00:00

NTRU Prime: more compiler warnings

This commit is contained in:
John M. Schanck 2020-09-01 15:56:45 -04:00 committed by Kris Kwiatkowski
parent 09d3f1e1e6
commit 191aed977f
24 changed files with 39 additions and 75 deletions

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_NTRULPR653_AVX2_crypto_decode_653x3(void *v, const unsigned char *s
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_NTRULPR653_CLEAN_crypto_decode_653x3(void *v, const unsigned char *
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_NTRULPR761_AVX2_crypto_decode_761x3(void *v, const unsigned char *s
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_NTRULPR761_CLEAN_crypto_decode_761x3(void *v, const unsigned char *
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_NTRULPR857_AVX2_crypto_decode_857x3(void *v, const unsigned char *s
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_NTRULPR857_CLEAN_crypto_decode_857x3(void *v, const unsigned char *
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }

View File

@ -241,7 +241,7 @@ int PQCLEAN_SNTRUP653_AVX2_crypto_core_mult3sntrup653(unsigned char *outbytes, c
mult768(fg, f, g); mult768(fg, f, g);
fg[0] -= fg[p - 1]; fg[0] = (int16) (fg[0] - fg[p - 1]);
for (i = 0; i < 768; i += 16) { for (i = 0; i < 768; i += 16) {
int16x16 fgi = load_x16(&fg[i]); int16x16 fgi = load_x16(&fg[i]);
int16x16 fgip = load_x16(&fg[i + p]); int16x16 fgip = load_x16(&fg[i + p]);

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_SNTRUP653_AVX2_crypto_decode_653x3(void *v, const unsigned char *s)
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_SNTRUP653_CLEAN_crypto_decode_653x3(void *v, const unsigned char *s
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }

View File

@ -241,7 +241,7 @@ int PQCLEAN_SNTRUP761_AVX2_crypto_core_mult3sntrup761(unsigned char *outbytes, c
mult768(fg, f, g); mult768(fg, f, g);
fg[0] -= fg[p - 1]; fg[0] = (int16) (fg[0] - fg[p - 1]);
for (i = 0; i < 768; i += 16) { for (i = 0; i < 768; i += 16) {
int16x16 fgi = load_x16(&fg[i]); int16x16 fgi = load_x16(&fg[i]);
int16x16 fgip = load_x16(&fg[i + p]); int16x16 fgip = load_x16(&fg[i + p]);

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_SNTRUP761_AVX2_crypto_decode_761x3(void *v, const unsigned char *s)
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_SNTRUP761_CLEAN_crypto_decode_761x3(void *v, const unsigned char *s
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }

View File

@ -278,7 +278,7 @@ int PQCLEAN_SNTRUP857_AVX2_crypto_core_mult3sntrup857(unsigned char *outbytes, c
mult1024(fg, f, g); mult1024(fg, f, g);
fg[0] -= fg[p - 1]; fg[0] = (int16) (fg[0] - fg[p - 1]);
for (i = 0; i < 1024; i += 16) { for (i = 0; i < 1024; i += 16) {
int16x16 fgi = load_x16(&fg[i]); int16x16 fgi = load_x16(&fg[i]);
int16x16 fgip = load_x16(&fg[i + p]); int16x16 fgip = load_x16(&fg[i + p]);

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -61,5 +61,5 @@ void PQCLEAN_SNTRUP857_AVX2_crypto_decode_857x3(void *v, const unsigned char *s)
nextf += 128; nextf += 128;
} }
*f = ((uint8)(*s & 3)) - 1; *f = (uint8) ((*s & 3) - 1);
} }

View File

@ -29,10 +29,6 @@ static inline __m256i signedshiftrightconst(__m256i x, int16 y) {
return _mm256_srai_epi16(x, y); return _mm256_srai_epi16(x, y);
} }
static inline __m256i addconst(__m256i x, int16 y) {
return add(x, _mm256_set1_epi16(y));
}
static inline __m256i subconst(__m256i x, int16 y) { static inline __m256i subconst(__m256i x, int16 y) {
return sub(x, _mm256_set1_epi16(y)); return sub(x, _mm256_set1_epi16(y));
} }

View File

@ -11,14 +11,14 @@ void PQCLEAN_SNTRUP857_CLEAN_crypto_decode_857x3(void *v, const unsigned char *s
for (i = 0; i < p / 4; ++i) { for (i = 0; i < p / 4; ++i) {
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
x >>= 2; x >>= 2;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }
x = *s++; x = *s++;
*f++ = ((uint8)(x & 3)) - 1; *f++ = (uint8) ((x & 3) - 1);
} }