From ceac286861928128d066b31c43e32a6034df0afb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Jan 2019 19:05:42 -0800 Subject: mpi: put access macros into mp_ namespace * mpi/mpi.h (mp_sign, mp_isneg, mp_used, mp_alloc, mp_digits, mp_digit): New macros, based on renaming SIGN, ISNEG, USED, ALLOC, DIGITS and DIGIT. (mp_set_prec): Use mp_digits instead of DIGITS. * mpi/mpi.c (SIGN, ISNEG, USED, ALLOC, DIGITS, DIGIT): Macros defined here now, as local aliases for their namespaced counterparts. * arith.c (signum, floordiv): Replace ISNEG with mp_isneg. * rand.c (random): Replace ISNEG with mp_isneg. * sysif.c (off_t_num): Replace USED, DIGITS and ISNEG with mp_used, mp_digits and mp_isneg. --- sysif.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sysif.c') diff --git a/sysif.c b/sysif.c index 9d818bbb..dbf853f2 100644 --- a/sysif.c +++ b/sysif.c @@ -1349,29 +1349,29 @@ off_t off_t_num(val num) mp_int *mpn = mp(num); if (odig > 1) { - if (USED(mpn) > odig) + if (mp_used(mpn) > odig) goto toobig; - if (USED(mpn) == odig && - (DIGITS(mpn)[USED(mpn) - 1] >> (MP_DIGIT_BIT - 1)) != 0) + if (mp_used(mpn) == odig && + (mp_digits(mpn)[mp_used(mpn) - 1] >> (MP_DIGIT_BIT - 1)) != 0) goto toobig; - for (out = 0, i = USED(mpn) - 1; i >= 0; i--) { + for (out = 0, i = mp_used(mpn) - 1; i >= 0; i--) { out <<= MP_DIGIT_BIT * (odig > 1); - out |= DIGITS(mpn)[i]; + out |= mp_digits(mpn)[i]; } - return (ISNEG(mpn)) ? -out : out; + return (mp_isneg(mpn)) ? -out : out; } else { - mp_digit d = DIGITS(mpn)[0]; + mp_digit d = mp_digits(mpn)[0]; - if (USED(mpn) > 1) + if (mp_used(mpn) > 1) goto toobig; if (d > OFF_T_MAX) goto toobig; - return (ISNEG(mpn)) ? d : -d; + return (mp_isneg(mpn)) ? d : -d; } } default: -- cgit v1.2.3