From: Marius Vollmer <mvo@zagadka.de>
Cc: guile-devel@gnu.org
Subject: Re: gmp issues (long)
Date: 25 Feb 2003 23:32:22 +0100 [thread overview]
Message-ID: <87smuc6lft.fsf@zagadka.ping.de> (raw)
In-Reply-To: <87wujoqado.fsf@raven.i.defaultvalue.org>
Rob Browning <rlb@defaultvalue.org> writes:
> Marius Vollmer <mvo@zagadka.de> writes:
>
> > I'm not so much worried about the size of an mpz_t but about the
> > fact that it requires an additional malloc.
>
> OK, though an extra 6 bytes of overhead (actually 8 if you include the
> fact that mpzs can't allocate in 2-byte-increments) for a 6 byte
> integer still concerns me a bit, but perhaps it's OK -- and not
> worrying about it will certainly keep the code simpler.
If can reduce the overhead, that would be a good thing of course. But
for the immediate performance problem, I wouldn't worry about it.
> So is there a way we can memcpy the mpz_t data into the double cell's
> three words, or would I need to pass the individual coerced pieces of
> the mpz_t to a call to scm_double_cell?
The way I understand things, GMP does not allocate the mpz_t's itself,
right? Then you should be able to do things like
SCM z = scm_double_cell (bignum_tag, 0, 0, 0);
mpz_init (SCM_CELL_ADDR_1 (z));
where SCM_CELL_ADDR_1 or something similar needs to be added to gc.h.
> i.e. is it OK to presume cell words are guaranteed to be contiguous,
Yes.
> or are you required to go through the SCM_CELL_N interface?
We can make an additional interface (say SCM_CELL_BODY_ADDR) for
treating the last three slots of a double cell as one memory block.
> > There should be a test somewhere whether mpz_t really fits into this
> > space. For now we can just wait for this test to fail, I'd say.
>
> What would be the correct formulation of this test? Would this be
> right?
>
> sizeof (mpz_t) <= 3 * sizeof (SCM)
>
> or perhaps given scm_double_cell's prototype
>
> sizeof (mpz_t) <= 3 * sizeof (scm_t_bits)
Hmm, both look good to me... but the latter is probably more right.
When we have SCM_CELL_BODY_ADDR we can also have
SCM_SIZEOF_DOUBLE_CELL_BODY.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2003-02-25 22:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-24 22:29 gmp issues (long) Rob Browning
2003-02-25 20:54 ` Marius Vollmer
2003-02-25 22:10 ` Rob Browning
2003-02-25 22:32 ` Marius Vollmer [this message]
2003-02-25 22:50 ` Rob Browning
2003-02-25 23:01 ` Marius Vollmer
2003-02-25 23:23 ` Rob Browning
2003-02-26 22:07 ` Kevin Ryde
[not found] <E18ndhx-0007Cm-00@monty-python.gnu.org>
2003-02-25 19:32 ` Stephen Compall
2003-02-25 20:08 ` Rob Browning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87smuc6lft.fsf@zagadka.ping.de \
--to=mvo@zagadka.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).