div2 and nails

Kevin Ryde user42 at zip.com.au
Sat Dec 13 10:23:55 CET 2003


nisse at lysator.liu.se (Niels Möller) writes:
>
> sub_ddmmss, which is blissfully ignorant of any nail usage.

In mpm I'd made myself a bit of a macro to do a two-"numb" subtract.

    #define SUB_2(w1,w0, x1,x0, y1,y0)                      \
      do {                                                  \
        ASSERT_LIMB (x1);                                   \
        ASSERT_LIMB (x0);                                   \
        ASSERT_LIMB (y1);                                   \
        ASSERT_LIMB (y0);                                   \
                                                            \
        if (GMP_NAIL_BITS == 0)                             \
          sub_ddmmss (w1,w0, x1,x0, y1,y0);                 \
        else                                                \
          {                                                 \
            mp_limb_t   __w0, __c;                          \
            SUBC_LIMB (__c, __w0, x0, y0);                  \
            (w1) = ((x1) - (y1) - __c) & GMP_NUMB_MASK;     \
            (w0) = __w0;                                    \
          }                                                 \
      } while (0)

SUBC_LIMB is in gmp-impl.h now, but something like a SUB_2 hasn't been
needed so far.


More information about the gmp-devel mailing list