[libmath-prime-util-perl] 18/40: Turn on gcc's uint128 types if we have a new enough version
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:49:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.30
in repository libmath-prime-util-perl.
commit 7ace5fb5dbdb0eba36d3154f6607420b66bb3f7a
Author: Dana Jacobsen <dana at acm.org>
Date: Thu Jul 11 17:25:55 2013 -0700
Turn on gcc's uint128 types if we have a new enough version
---
mulmod.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/mulmod.h b/mulmod.h
index d44d58b..91c6ca0 100644
--- a/mulmod.h
+++ b/mulmod.h
@@ -38,7 +38,7 @@
:"%rax", "%rdx" /* clobbered registers */
);
/* A version for _MSC_VER:
- *
+ *
* __asm { mov rax, qword ptr a
* mul qword ptr b
* div qword ptr c
@@ -49,12 +49,16 @@
#define mulmod(a,b,m) _mulmod(a,b,m)
#define sqrmod(n,m) _mulmod(n,n,m)
-#elif 0
+#elif __GNUC__ == 4 && __GNUC_MINOR__ >= 4
- /* Finding out if these types are supported requires non-trivial
- * configuration. They are very fast if they exist. */
- #define mulmod(a,b,m) (UV)(((__uint128_t)(a)*(__uint128_t)(b)) % ((__uint128_t)(m)))
- #define sqrmod(n,m) (UV)(((__uint128_t)(n)*(__uint128_t)(n)) % ((__uint128_t)(m)))
+ #if __GNUC__ == 4 && __GNUC_MINOR__ >= 4 && __GNUC_MINOR__ < 6
+ typedef unsigned int uint128_t __attribute__ ((__mode__ (TI)));
+ #else
+ typedef unsigned __int128 uint128_t;
+ #endif
+
+ #define mulmod(a,b,m) (UV)(((uint128_t)(a)*(uint128_t)(b)) % ((uint128_t)(m)))
+ #define sqrmod(n,m) (UV)(((uint128_t)(n)*(uint128_t)(n)) % ((uint128_t)(m)))
#else
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list