mpz_{eq,lt,gt}_{ui,si}_p macros?

Niels Möller nisse at lysator.liu.se
Sun Feb 10 22:02:30 CET 2013


bodrato at mail.dm.unipi.it writes:

> Let's take the gt_ui macro:
> #define mpz_gt_ui_p(Z,UI)                                               \
>   (__builtin_constant_p (UI) && (UI) == 0 ? (Z)->_mp_size > 0           \
>    : __builtin_constant_p ((UI) >= 0 && (UI) <= GMP_NUMB_MAX)           \
>    && ((UI) >= 0 && (UI) <= GMP_NUMB_MAX)                               \
>    ? (Z)->_mp_size > ((Z)->_mp_d[0] <= __GMP_CAST (mp_limb_t, UI))      \
>    : _mpz_cmp_ui (Z,UI) > 0)

I think this begs for yet another macro,

  #define constantly_true_p(x) (__builtin_constant_p((x)) && (x))

Not entirely sure if I should suggest this seriously or not...

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list