[S21.5] Add bignums to FAQ
james at xemacs.org
Wed Apr 7 10:57:53 EDT 2004
"Stephen J. Turnbull" <stephen at xemacs.org>:
>>>>>> "Hrvoje" == Hrvoje Niksic <hniksic at xemacs.org> writes:
> Hrvoje> "Stephen J. Turnbull" <stephen at xemacs.org> writes:
> >> You should just treat a bignum as a blob of memory with an
> >> lrecord_header attached, or whatever, ie, an "opaque".
> Hrvoje> As long as we *know* that they don't contain pointers to
> Hrvoje> heap-allocated data, this is fine. Do we know that?
> Hmm ... apt-get update libgmp3-doc and ... oops, they are indirect,
> containing pointers to separately allocated memory, rather than being
> an immediate representation. So we'll have to treat them like strings
> rather than opaques, and I don't offhand see how to stuff the
> information back in them, but probably we just need to update the
> pointers properly.
Sorry for dropping out of the conversation last night guys. I could
have told you that bignums (and ratios, and bigfloats) are pointers into
the heap with both GNU MP and BSD MP.
So is there some way to store them as strings, and reconstitute them
from those strings later?
> I know that Python at least and probably Perl have MP modules. I bet
> Python bignums have a pickle method, and if so they've already solved
> this problem. The usual licenses in those communities are upwardly
> compatible with GPL, so we could probably even steal code.
Sounds great, at least for someone who knows something about Python
pickling, which isn't me.
More information about the XEmacs-Beta