Re: mpz_t caching

2015-09-04 Thread Niels Möller
ike valgrind don't complain. And there are also thread-safety issues; currently GMP leaves all such problems to the provided allocation function, while a cache would need some thread-local storage (or locks, but I guess that's highly undesirable if the idea is to gain performance). Regards, /Niels --

Re: Lazy mpz allocation

2015-09-28 Thread Niels Möller
as case (2), and the allocated storage will leak. But I think it is acceptable to have some random bad things happen on misuse. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___

Re: Pull request: Raise SIGFPE instead of abort in __gmp_exception`

2016-01-07 Thread Niels Möller
ay be needed; I think both abort and raise are ANSI C, but I suspect SIGFPE isn't. Depending on pthreads functions is undesirable. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government

Re: Pull request: Raise SIGFPE instead of abort in __gmp_exception`

2016-01-11 Thread Niels Möller
roval procedure at work. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

mpq_cmp

2016-05-26 Thread Niels Möller
of elements and terminate. // Compute full products. If practical, high limb first with early // termination. return sgn (a d - b c) Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___

Re: Register gmp with pkg-config

2016-06-15 Thread Niels Möller
e. Couldn't find a howto for contributors on the website, > would've sent a patch directly otherwise. Please send patches to this list. For non-trivial changes, we ask for a Free Software Foundation copyright assignment. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Key

Re: Pull request: Raise SIGFPE instead of abort in __gmp_exception`

2016-01-28 Thread Niels Möller
ault handler. Still tricky to safely use a handler which doesn't terminate the program, but at least cleaner and more portable than using signal handlers. In particular, mixing signals and longjmp really makes me uneasy... Not sure what the other developers think? Regards, /Niels -- Niels Möller. PG

Re: Pull request: Raise SIGFPE instead of abort in __gmp_exception`

2016-01-28 Thread Niels Möller
ndefined behaviour. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Pull request: Raise SIGFPE instead of abort in __gmp_exception`

2016-01-28 Thread Niels Möller
t; > [1] https://gmplib.org/repo/gmp/ Maybe there's something wrong with the mirroring to the public repo? It's missing my checkin and a previous one of Torbjörn's, compared to what I see with ssh access to shell.gmplib.org/var/hg/gmp. Regards, /Niels -- Niels Möller. PGP-encrypted emai

Re: getrusage vs clock

2016-01-21 Thread Niels Möller
gh precision per-process cpu time. And it's news to me that the old clock function uses the same timers in recent glibc. But it sounds nice. What's the value of CLOCKS_PER_SEC? Does it match the actual resolution? Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26

Re: mpn_redc_n

2016-03-14 Thread Niels Möller
to try to merge my old bdiv changes? I don't even recall the details, but IIRC, the log message is "New bdiv convention, R B^{qn} = U + Q D", and I think the bdiv return value is also the carry out from that addition. In ~nisse/hack/gmp-bdiv on shell. Regards, /Niels -- Niels

Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Niels Möller
reak. I think the autoconf manual recommends an explicit include of config.h (guarded by HAVE_CONFIG_H) first in every C file. We don't have to do it that way of course, just be aware that we depart from that convention. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid

Re: Lazy mpz allocation

2016-05-04 Thread Niels Möller
an integer", and treated as one. /nisse -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: mpn_invert_limb

2016-07-15 Thread Niels Möller
far as I can see, and most recently mentioned in ChangeLog back in 2002. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-deve

Re: Add mpz_inp_str to mini-gmp

2016-07-08 Thread Niels Möller
nput characters are considered to terminate the input. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org htt

Re: Add mpz_inp_str to mini-gmp

2016-07-08 Thread Niels Möller
Extending support up to base == 62 sounds reasonable to me. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Add mpz_inp_str to mini-gmp

2016-07-09 Thread Niels Möller
riable, use a separate int res. > gmp_free (buf); > /* 0 on error else number of characters read excluding null-terminator */ Drop " excluding...", or change "null-" to "NUL ". > return (c == -1 ? 0 : nread); > } Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Add mpz_inp_str to mini-gmp

2016-07-06 Thread Niels Möller
support for base == 0 for the mini-gmp version of mpz_inp_str, if that makes things simpler. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel

Re: increase mini-gmp base support to 62

2017-02-03 Thread Niels Möller
ld make more sense to me to treat that as an error. > else > { > base = -base; > if (base > 36) >return NULL; >} /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government sur

Re: mpn_sqrtrem{1,2}

2017-02-01 Thread Niels Möller
e to add such checks in GMP code? It's not that hard to add new assembly files. You need to know some assembly, of course. And be aware that gmp uses m4 to preprocess assembly source files. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subj

Re: increase mini-gmp base support to 62

2017-02-01 Thread Niels Möller
tach an alternative patch. Please revise it. Looks good. Only detail I don't quite like is the variable name "lowercaseoffset". Maybe "value_of_a" (since it's the value of the digit 'a')? Or at least add an underscore or two, lowercase_offset. Thanks, /Niels -- Niels Möller. PGP

Re: Problem with gmp_randinit_set

2017-02-19 Thread Niels Möller
with shift should be equivalent to the current mpz code, maybe mine too (it essentially combines the shift with the addmul_1 call). > Is it worth doing? I think it's desirable to eliminate the dependency on mpz. How important it is not change the seed --> sequence mapping, I don't know

Re: Recent changes to mpn_get_str/mpn_set_str

2017-02-15 Thread Niels Möller
ul wins over repated mul_1. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: mpz reuse test takes too much time

2017-01-18 Thread Niels Möller
> its length in limbs is not smaller than the length of B. Maybe the way mpn_gcdext handles this can be more or less unchanged. But we shouldn't have to zeropad the input. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale gove

Re: GMP work on symbol visibility

2016-09-03 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > Is this 6 year old post still valid? Hmm, here's a related gcc bug with is marked as fixed, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51880, also marked as a dup of the old bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19520 Ian ref

Re: GMP work on symbol visibility

2016-09-01 Thread Niels Möller
e, which would be an issue if we have lots of "protected" symbols, and IIRC, I think Ian said that glibc's ld.so was poorly optimized for this case, so protected symbols could make library load slower than using "default" visibility. /Niels -- Niels Möller. PGP-encrypted emai

Re: [PATCH] Add pkg-config support

2016-08-30 Thread Niels Möller
prefer to not have any version number here. And if a program needs to test for a particular gmp feature, I *strongly* recommend doing traditional autoconf-style functional tests for the features that are actually needed. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E

Re: GMP work on symbol visibility

2016-09-01 Thread Niels Möller
lag saying "ignore hidden"? Or simply collect the object files into a static library. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. ___ gmp-devel mail

Re: [PATCH] Add pkg-config support

2016-08-30 Thread Niels Möller
se are needed if using shared libraries installed in some location not included in the default ld.so search path. E.g., say I configure gmp with --prefix=/pkg/gmp/6.1.1/x86_64, without adding the corresponding lib directory to /etc/ld.so.conf or similar. Regards, /Niels -- Niels Möller. PGP-e

Re: Flurry of GMP check failures

2016-11-06 Thread Niels Möller
; I have a very fuzzy understanding of the details). And if the code is expected to be pic and sharable at loadtime, neither reloc type should be used in the text or rodata segment; while R_X86_64_64 is perfectly fine for tables placed in the data segment. Regards, /Niels -- Niels Möller. PGP-encrypt

Re: Flurry of GMP check failures

2016-11-05 Thread Niels Möller
. At this point in time, I think use-cases involving static libgmp.a (or libnettle.a) are somewhat obscure. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _

Re: Flurry of GMP check failures

2016-11-05 Thread Niels Möller
maybe something is broken. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Flurry of GMP check failures

2016-11-05 Thread Niels Möller
currently causes some trouble in > configure). > > Note that I do not care about security in either case. -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
//gmplib.org/devel/incompatibility.html Agreed, and it's not obvious what's the right interface either. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2] /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government survei

Re: Help stabilising mini-gmp

2016-11-21 Thread Niels Möller
to think about whether we should make a "mini-gmp release" with bug-fixes, or just send out an announcement. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___

New mini-gmp macro GMP_CMP?

2016-11-22 Thread Niels Möller
const mpz_t u, unsigned long v) { ! if (GMP_ABS (u->_mp_size) > 1) return 1; ! else ! return GMP_CMP (mpz_get_ui (u), v); } -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance.

Re: Help stabilising mini-gmp

2016-11-22 Thread Niels Möller
ich could if it now passes? The LD_LIBRARY_PATH fixes? /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.or

mini-gmp testing (was: Re: Help stabilising mini-gmp)

2016-11-21 Thread Niels Möller
st inputs and validation of results somehow suits my taste better, but I have no good rational motivation for that. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. __

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
nd). It won't save much for the computation, only the final copy. But it's also a gain to clarity if callers don't have to pass in dummy, unused, result arguments. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale

Re: Using MPZ_ROINIT_N in mpz sources

2016-11-28 Thread Niels Möller
is that it should work also for compound initialization, like struct { int x; mpz_t y; } foo = { 1, MPZ_INITIALIZER; }; I think it might be useful to eventually make public too. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subj

Re: Seeding in mini-gmp

2016-11-24 Thread Niels Möller
ter range. E.g, low 48 bits of 100*tv_sec + tv_usec would wraparound in almost 9 years, and tv_sec + tv_usec << 28 would also fill 48 bits and collide rarely. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. I

Re: Help stabilising mini-gmp

2016-11-16 Thread Niels Möller
R_BUILD)" EXTRA_CFLAGS="-g -I../.." check + CC="$(CC)" EXTRA_CFLAGS="$(CFLAGS) -g -I../.." check clean-mini-gmp: if [ -d mini-gmp/tests ] ; then \ Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Ke

Re: Help stabilising mini-gmp

2016-11-15 Thread Niels Möller
n that's bad. I agree. Is there any easy way to use GNU make only for make check-mini-gmp? Either in test scripts, or automatically in that target (the make used for the target itself doens't matter, it's the recursive make, currently using $(MAKE), that really needs GNU make. /Niels -- Niels

Re: Help stabilising mini-gmp

2016-11-15 Thread Niels Möller
t-gcd So this one isn't clang only. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/lis

Re: Help stabilising mini-gmp

2016-11-15 Thread Niels Möller
e problems, please strike the > entire item by using Please also clean up the > ~gmp/gmp/check/failure report files. How, more precisely? Just delete the corresponding files? E.g, shell.gmplib.org-dyn-gcc49-g++49:64.txt shell.gmplib.org-dyn-gcc49-g++49:64.txt.gz /Niels -- Ni

Re: Help stabilising mini-gmp

2016-11-19 Thread Niels Möller
on shell fails with connection refused). And this failure was on the non-virtualized host sky, right, not on one of the vms? /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Help stabilising mini-gmp

2016-11-19 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > ni...@lysator.liu.se (Niels Möller) writes: > I don't think so. But I think the right way is to simply add $(CFLAGS) > to the linker command line. That's the usual way to use it, right? And > omitting it in the linking rule in mi

Re: Help stabilising mini-gmp

2016-11-20 Thread Niels Möller
t-signed.c:93:8: runtime error: signed integer overflow: -1 + -9223372036854775808 cannot be represented in type 'long int' FAIL: t-signed It would make sense to test both gmp and mini-gmp with -fsanitize=undefined. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid

Re: Help stabilising mini-gmp

2016-11-15 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > ni...@lysator.liu.se (Niels Möller) writes: > > I tried to mark the mini-gmp t-limbs section with , but saving my > changes from emacs failed, > > My bad, please try now. Worked better now. > How, more p

Re: Help stabilising mini-gmp

2016-11-20 Thread Niels Möller
like. For mini-gmp, I hope running the testsuite with a large number of random seeds should give good coverage, so we don't need any additional framework. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale g

Reorganized mini-gmp/tests/t-signed.

2016-11-20 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > Anyway, I can now repro locally, by running > > make check CFLAGS="-O -Wall -g -fsanitize=undefined -fno-sanitize-recover" > > in the mini-gmp/tests source directory. This fails with > > t-signed.c:93:8: runtime err

Re: Help stabilising mini-gmp

2016-11-20 Thread Niels Möller
d, t-powm and t-div) were all caused by the bug in mpn_invert_3by2, so hopefully fixed now. Or have you seen any new failures for those? /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale governme

Re: Help stabilising mini-gmp

2016-11-21 Thread Niels Möller
e what the behaviour is without that, if the program might complete normally with just logging of problems, or if detected problems still makes it exit with non-zero status. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government survei

Re: Help stabilising mini-gmp

2016-11-14 Thread Niels Möller
, e.g., HAVE_GETPID and HAVE_GETTIMEOFDAY. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Using MPZ_ROINIT_N in mpz sources

2016-11-27 Thread Niels Möller
we should have a separate macro for the initializer (and preferably point to some shared read-only limb). Or make mpz_init inline? Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. __

Re: mpz reuse test takes too much time

2016-12-02 Thread Niels Möller
d and 3-operand variants. > The old macros checked res3 even when it was not part of the > computation, exhibiting possibly undefined behaviour. > > OK with you to commit? Looks good to me, go aehad. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet em

Re: mpz reuse test takes too much time

2016-12-03 Thread Niels Möller
(NULL, y, t, y, x); > mpz_gcdext (NULL, s, x, x, y); mpz_gcdext (NULL, x, t, y, x); > mpz_gcdext (NULL, NULL, y, x, y); mpz_gcdext (NULL, x, NULL, x, y); ^ > mpz_gcdext (NULL, NULL, x, x, y); mpz_gcdext (NULL, y, NULL, x, y); ? ^ Maybe, except for the abov

Re: mpz reuse test takes too much time

2016-12-03 Thread Niels Möller
Marc Glisse <marc.gli...@inria.fr> writes: > On Sat, 3 Dec 2016, Niels Möller wrote: > >> Hmm, you changed the code to not only allow G to be NULL, but allow NULL >> S too? > > That was already the case before my patch. Sorry for the confusin, I had forgotten

Re: Changes for GMP 6.1.2

2016-11-29 Thread Niels Möller
s, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: mpz reuse test takes too much time

2016-12-02 Thread Niels Möller
mini-gmp test. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: mpz reuse test takes too much time

2017-01-01 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > In the case > > mpn_gcdext(G, S, NULL, A, B) > > with size(A) < size(B), IIRC we currently handle that by swapping > arguments, calling mpn_gcdext to compute T (even though the caller > didn't need that, and produce S with

Re: Test compile: mpn_lshift_com optimization 2

2017-01-04 Thread Niels Möller
.c" or "a.out" files in my gmp tree. Please also provide the additional information requested in the Bug reporting instructions in the manual. For what it's worth, TESTS_ENVIROMENT=valgrind make check works fine in my gmp build. Regards, /Niels -- Niels Möller. PGP-encrypted

Re: mpz_gcd_ext(NULL, ...)

2017-01-01 Thread Niels Möller
eed to either keep MPZ_REALLOC, or check for that special case. So I'm afraid the reuse test doesn't hit this corner... Regards, and Happy New Year, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _

Re: Test compile: mpn_lshift_com optimization 2

2017-01-04 Thread Niels Möller
Emmanuel Thomé <emmanuel.th...@inria.fr> writes: > On Wed, Jan 04, 2017 at 03:08:57PM +0100, Niels Möller wrote: >> I'm also a bit puzzled. And after a quick look, I can't find any >> lshift_com function in mul_fft.c (or anywhere else but acinclude.m4). > > It's

Re: mpn_sqrtrem1

2016-12-20 Thread Niels Möller
ers to the initial values of these variables. Which can be accumulated into the final product. But it still won't beat the plain version on any machine with a reasonable mul-instruction. /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 36

Re: More mini-gmp asserts?

2017-07-23 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > ni...@lysator.liu.se (Niels Möller) writes: > > Hi, I'm considering adding no-overlap asserts to mini-gmp's mpn_mul > function. Any reason not to? If we do it by copying the MPN_OVERLAP_P > macro, we should add a GMP_-prefi

Re: mpn_invert_limb

2017-07-23 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > These date back to 68020 and 80386. I.e., quite obsolete. :-) Gone now. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveilla

Re: mpn_sqrtrem{1,2} - patch for pure C implem

2017-06-09 Thread Niels Möller
11 bits */ One could save an instruction with using just l(a) = (a >> GMP_NUMB_BITS - 20) and adjusting the tables accordingly. You'd get a larger multiply, but limiting to 16x16 is probably not a saving on relevant platforms. Regards, /Niels -- Niels Möller. PGP-encrypted email

Re: GMP's x86-32 performance

2017-06-17 Thread Niels Möller
as the additional advantage that more of the evaluation work is loop-invariant, and we could also jump to separate innerloops depending on the carry bits from evaluation. Perhaps this is still crazy, and useful only for machines with very slow multiplication. Regards, /Niels -- Niels Möller. PGP-e

addmul_k with toom (was: Re: GMP's x86-32 performance)

2017-06-17 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > ni...@lysator.liu.se (Niels Möller) writes: > we might also try doing addmul_2 using toom32, which > would save 1/3 of the mul instructions. Toom32 is nice because we can > use the four easiest evaluation points: 0, infini

Re: Fast mpz_bin_ui

2017-10-06 Thread Niels Möller
rk to first take out powers of two, and then rewrite multiplies as squares like n (n-2) = (n-1)^2 - 1 n (n-2)(n-4)(n-6) = [(n-3)^2 - 5]^2 - 25 Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholes

Re: Fast mpz_bin_ui

2017-10-12 Thread Niels Möller
y more smooth, since it's going to be huge compared to n, but still can't have any prime factors larger than n. But we can still have lots of prime factors in the range k < p <= n. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wh

Re: Revisiting gcd and gcdext for small operands

2017-12-01 Thread Niels Möller
ar combination a <-- k a + m b (like the "accelerated gcd" by Ken Weber, and with some need to handle spurious factors). One can gain one bit by using signed values, though, and choose q so that |q| < 2^{k-1}). Putting k = 3 (as you suggest) and |q| < 4 might give a speedup o

Re: mini-gmp

2017-12-06 Thread Niels Möller
icated random numbers is out-of-scope for mini-gmp. > and finally mpz_dump. Hmm. It seems this function is declared in gmp.h, but not mentioned in the manual, and with a discouraging comment at the top of mpz/dump.c. Any reason you can't switch to always use mpz_out_str instead? Regards, /Niel

Re: mini-gmp

2017-12-06 Thread Niels Möller
be? The only "releases" of mini-gmp are gmp releases, should we adopt that, and then have no well-defined version number for mini-gmp between gmp releases? I'm afraid I'm still a bit confused, and I don't quite understand what problem you are aiming to solve with additional defines in min

Re: mini-gmp

2017-12-06 Thread Niels Möller
nice, but it's also massive overkill. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

Re: Generic get_d_2exp failures

2017-10-28 Thread Niels Möller
d) - l; + if (r > 0) + s -= 2*r; + d = s; weight /= MP_BASE_AS_DOUBLE; if (weight == 0) break; > 3) Drop the generic path. It hasn't passed the testsuite for a long > time, can't be that important. If we keep it, we'd need to (i) fix

Re: Generic get_d_2exp failures

2017-10-28 Thread Niels Möller
Marc Glisse <marc.gli...@inria.fr> writes: > On Sat, 28 Oct 2017, Niels Möller wrote: > >> It would be nice if we could find a portable way to add two floating >> point values without rounding up. Would something like this work? >> >> s = a + b; /*

Re: udiv_qr_3by2 vs divappr

2018-05-09 Thread Niels Möller
e q = divappr_2(...); submul_1 + adjustment } Left to do is strict analysis of the case d0 == 0, the code seems to work fine without any special case for that, even the computation of r1 (based on the assumption that d0 > 0) is off by one in this case. Regards, /Niels --

Re: dead code in div_q.c?

2018-04-27 Thread Niels Möller
we would get for the correct quotient. I.e., that the qh return values from div and divappr always match. Seems particularly unlikely for the mu divappr, which can have an error larger than 1 unit. Not sure how to come up with an example, though. Regards, /Niels -- Niels Möller. PGP-encrypted e

Re: documentation on internals not up to date

2018-04-27 Thread Niels Möller
c keeps supporting thuis case. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel

divappr interface

2018-04-27 Thread Niels Möller
_np, np + nn - new_nn, new_nn, cnt); ... qh = mpn_sbpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, dinv.inv32); implies that new_nn and the shift are twice as large as they need to be (new_nn should be only qn+2). Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Ke

Re: dead code in div_q.c?

2018-04-27 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > --- a/tests/mpn/t-div.c Wed Apr 25 07:38:14 2018 +0200 > +++ b/tests/mpn/t-div.c Wed Apr 25 22:19:17 2018 +0200 > @@ -445,6 +445,7 @@ main (int argc, char **argv) > alloc = itch + 1; > } > s

Re: documentation on internals not up to date

2018-04-27 Thread Niels Möller
t behaves in the same friendly way. E.g., in case we for some reason change the internals to break assignment to non-zero unallocated objects, we could hack mpq_denref to do a real allocation if needed (except that the macro is documented to work on a const mpq_t). Or go back to using an allocate

Re: divappr interface

2018-04-27 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > Once we reach qn = dn - 1, keep looping to produce quotient limbs, but > also discard one limb of dp in each interation, until we in the final > iteration have qn = 1, qn+2 = 3 numerator limbs, and qn+1 = 2 divisor > limbs, i.e., a single

udiv_qr_3by2 vs divappr

2018-04-28 Thread Niels Möller
arguments to be normalized up front, but instead just normalizes top limbs on the fly. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-devel mailing

Re: documentation on internals not up to date

2018-05-05 Thread Niels Möller
this. > + > +@code{mpz_t} variables initialised with the @code{mpz_roinit_n} function > +or the @code{MPZ_ROINIT_N} macro have @code{_mp_alloc = 0} but can have a > +non-zero @code{_mp_size}. They can only be used as read-only constants. > +See @ref{Integer Special Functions} for det

Re: _ptr and _srcptr types

2018-05-19 Thread Niels Möller
his strange C++ quirk by expanding NULL to some magic *slightly* different from 0, which will produce some warnings if it used as an integer rather then pointer). Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale go

Re: mini-gmp mpz_{get,set}_d not fully compatible with GMP

2018-05-19 Thread Niels Möller
ay 18 07:24:52 2018 +0200 > @@ -50,6 +50,9 @@ > > #include "mini-gmp.h" > > +#if !defined(DONT_USE_FLOAT_H) > +#include > +#endif Makes sense to me, provided that the define also excludes whatever mini-gmp functions depend on float.h (which would be get_d and set

Re: mini-gmp mpz_{get,set}_d not fully compatible with GMP

2018-05-20 Thread Niels Möller
s 2^i +/- 1 to double and comparing the results (before your fix, mini-gmp rounded to nearest, producing identical doubles for large enough i). Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance.

Re: _ptr and _srcptr types

2018-05-20 Thread Niels Möller
nter can use different representation than void*. If that really is the case, most occurences of NULL or (void*)0 in the argument list in the call of a varargs function would be undefined behavior, right? Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. In

Re: _ptr and _srcptr types

2018-05-16 Thread Niels Möller
e struct, i.e., the type that an mpz_t "decays" to in expression context. > (Should we provide similar types for mpq and mpf?) Yes. In m opinion, every advertised typedef of an array type should have a corresponding advertised pointer type. Regards, /Niels -- Niels Möller. PGP-encrypt

Re: Any interest in multi-threaded code?

2018-05-15 Thread Niels Möller
"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes: > I merged the current head with that 10 years old repository, try again. Thanks for taking care of that! Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to w

Re: _ptr and _srcptr types

2018-05-15 Thread Niels Möller
they were implemented as (inline) functions rather than macros. I don't think need for handling pointers is that common in GMP user code, but not so obscure that it should be ignored and unsupported. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Intern

Re: _ptr and _srcptr types

2018-05-26 Thread Niels Möller
ame for the internal types, but actual names for types defined. I'd prefer to either use the actual internal name __mpz_struct instead of some_internal_data_type above, or change to the obviously made up name foo consistently, like typedef foo_internal foo_t[1]; typedef foo_internal * foo

Re: mini-gmp mpz_{get,set}_d not fully compatible with GMP

2018-05-26 Thread Niels Möller
"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes: > Il Dom, 20 Maggio 2018 9:57 pm, Niels Möller ha scritto: >> You could consider making this into small step towards modularizing >> mini-gmp. Something like > >> #ifndef MINI_GMP_FLOAT_SUPPORT > >&g

Re: mini-gmp mpz_{get,set}_d not fully compatible with GMP

2018-05-20 Thread Niels Möller
ithout HAVE_DOUBLE_VAX_D? Testing the generic code seems more important than testing VAX-specific optimizations. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _

Re: udiv_qr_3by2 vs divappr

2018-05-02 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > ni...@lysator.liu.se (Niels Möller) writes: > > Yes. By one if divappr_2 can produce a useful single-limb > remainder, otherwise by two. > > I am very curious about the result of this work. A larger submul_1 > trip

Re: udiv_qr_3by2 vs divappr

2018-05-01 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > So the submul_1 size agument will increase slightly? Yes. By one if divappr_2 can produce a useful single-limb remainder, otherwise by two. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet em

<    1   2   3   4   5   6   7   8   >