* Multiple precision stuff
*
* May use OpenSSL's BIGNUM if built with TLS,
- * or GNU's multiple precision library.
+ * or GNU's multiple precision library. But if
+ * long long is available, that's big enough
+ * and much more efficient.
*
* If none is available, unsigned long data is used.
*/
-#ifdef HAVE_BIGNUM
+#if !defined(HAVE_LONG_LONG)
+#if defined(HAVE_BIGNUM)
+#define USE_BIGNUM
+#elif defined(HAVE_GMP)
+#define USE_GMP
+#endif
+#endif
+
+#ifdef USE_BIGNUM
/*
* Use OpenSSL's BIGNUM
*/
#define ldap_pvt_mp_clear(mp) \
do { BN_free((mp)); (mp) = 0; } while (0)
-#elif defined(HAVE_GMP)
+#elif defined(USE_GMP)
/*
* Use GNU's multiple precision library
*/
#define ldap_pvt_mp_clear(mp) \
mpz_clear((mp))
-#else /* ! HAVE_BIGNUM && ! HAVE_GMP */
+#else /* ! USE_BIGNUM && ! USE_GMP */
/*
* Use unsigned long
*/
#define ldap_pvt_mp_clear(mp) \
(mp) = 0
-#endif /* ! HAVE_BIGNUM && ! HAVE_GMP */
+#endif /* ! USE_BIGNUM && ! USE_GMP */
#include "ldap_pvt_uc.h"
/* NOTE: this macro assumes that bv has been allocated
* by ber_* malloc functions or is { 0L, NULL } */
-#if defined(HAVE_BIGNUM)
+#if defined(USE_BIGNUM)
#define UI2BVX(bv,ui,ctx) \
do { \
char *val; \
BER_BVZERO( (bv) ); \
} \
} while ( 0 )
-#elif defined(HAVE_GMP)
+#elif defined(USE_GMP)
/* NOTE: according to the documentation, the result
* of mpz_sizeinbase() can exceed the length of the
* string representation of the number by 1