commit
a0a86c696a
@ -72,6 +72,12 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
|
|||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if an illegal character was found, fail. */
|
||||||
|
if (!(*str == '\0' || *str == '\r' || *str == '\n')) {
|
||||||
|
mp_zero(a);
|
||||||
|
return MP_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* set the sign only if a != 0 */
|
/* set the sign only if a != 0 */
|
||||||
if (mp_iszero(a) != MP_YES) {
|
if (mp_iszero(a) != MP_YES) {
|
||||||
a->sign = neg;
|
a->sign = neg;
|
||||||
|
@ -203,7 +203,7 @@ int mp_init_size(mp_int *a, int size);
|
|||||||
|
|
||||||
/* ---> Basic Manipulations <--- */
|
/* ---> Basic Manipulations <--- */
|
||||||
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
|
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
|
||||||
#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
|
#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
|
||||||
#define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
|
#define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
|
||||||
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
|
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user