Re: trouble implementing infinint un/boxing for C binding

Denis Corbin <[email protected]>
Newsgroups gmane.comp.sysutils.backup.dar.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wesley Leggette wrote:
| I have a series of functions
| <http://darbinding.sourceforge.net/libdarc/group__trans__typedefs.html>
| that can be used to box/unbox an infinint to and from platform types.
| I'm having trouble implementing these. It looks like the functions I
| need are infinint::infinint_from<class T> and
| infinint::infinint_unstack_to<class T>, but these are private functions.
| Is there a public way of accomplishing this? If not, it looks like I
| would have to reimplement these functions myself?

No, you should not have to reimplement theses. The unstack() method for
infinint is public. it works this way.

assuming you have an infinint 't' you want to convert to unsigned int x:

	x = 0;
	t.unstack(x);
~        // t is decremented as much as possible, up to zero
	// x is incremented as much as t has been decremented

note that if t was larger than the max value of unsigned int, x is set
to the max value and t is decremented by this amount only, so t may
remains different of zero. So usually you need a loop:

~        while(t != 0)
~         {
~            x = 0;
	    t.unstack(x);
~            for(unsigned int i = 0; i < x; i++)
~               /// do something

~         }

|
| If those two functions could be changed to public, I can of course
| provide the patches. Would this break ABI on libdar?
|

there is no need to do so.

| Thanks,

P.S.: by the way, the libdar-API mailing list is probably a more
appropriate place for this type of technical discussion, it might also
interest some API users.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCJiVDpC5CI8gYGlIRAqnLAKCu9Mu3KF+C96zfTOggoYoC/6+K/wCglK04
Dkyi5XkOgYyQC4nwq4g3RVk=
=loko
-----END PGP SIGNATURE-----



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.