bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Missing parenthesis in the MPN_NORMALIZE macro


From: Niels Möller
Subject: Missing parenthesis in the MPN_NORMALIZE macro
Date: 03 Jul 2003 13:50:47 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

This macro is defined in gmp-impl.h, gmp-4.1.2, as

#define MPN_NORMALIZE(DST, NLIMBS) \
  do {                                                                  \
    while (NLIMBS > 0)                                                  \
      {                                                                 \
        if ((DST)[(NLIMBS) - 1] != 0)                                   \
          break;                                                        \
        NLIMBS--;                                                       \
      }                                                                 \
  } while (0)

This doesn't work when the macro is used like

  mp_ptr xp;
  mp_size_t *xsize;

  ...
  MPN_NORMALIZE(xp, *xsize)

It should be

#define MPN_NORMALIZE(DST, NLIMBS) \
  do {                                                                  \
    while ((NLIMBS) > 0)                                                \
      {                                                                 \
        if ((DST)[(NLIMBS) - 1] != 0)                                   \
          break;                                                        \
        (NLIMBS)--;                                                     \
      }                                                                 \
  } while (0)

Regards,
/Niels




reply via email to

[Prev in Thread] Current Thread [Next in Thread]