literal suffix

This commit is contained in:
Francois Perrad 2019-09-07 12:28:26 +02:00
parent 84fc6abeb5
commit 8cf0d3db85
3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ mp_err mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
} }
/* power of two ? */ /* power of two ? */
if ((b & (b-1)) == 0u) { if ((b & (b - 1u)) == 0u) {
ix = 1; ix = 1;
while ((ix < MP_DIGIT_BIT) && (b != (((mp_digit)1)<<ix))) { while ((ix < MP_DIGIT_BIT) && (b != (((mp_digit)1)<<ix))) {
ix++; ix++;

View File

@ -16,7 +16,7 @@ mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, int radix)
char *_s = str; char *_s = str;
/* check range of the maxlen, radix */ /* check range of the maxlen, radix */
if ((maxlen < 2) || (radix < 2) || (radix > 64)) { if ((maxlen < 2u) || (radix < 2) || (radix > 64)) {
return MP_VAL; return MP_VAL;
} }
@ -46,7 +46,7 @@ mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, int radix)
digs = 0; digs = 0;
while (!MP_IS_ZERO(&t)) { while (!MP_IS_ZERO(&t)) {
if (--maxlen < 1) { if (--maxlen < 1u) {
/* no more room */ /* no more room */
err = MP_VAL; err = MP_VAL;
break; break;

View File

@ -143,7 +143,7 @@ extern void MP_FREE(void *mem, size_t size);
/* feature detection macro */ /* feature detection macro */
#define MP_STRINGIZE(x) MP__STRINGIZE(x) #define MP_STRINGIZE(x) MP__STRINGIZE(x)
#define MP__STRINGIZE(x) ""#x"" #define MP__STRINGIZE(x) ""#x""
#define MP_HAS(x) (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1) #define MP_HAS(x) (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1u)
/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */ /* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
#undef mp_word #undef mp_word