Re: Re: trouble implementing infinint un/boxing for C binding

Wesley Leggette <lists-+42/j/[email protected]> Thu, 03 Mar 2005 05:40:18 +0100
Newsgroups gmane.comp.sysutils.backup.dar.general
Message-ID <1109824818.22341.0.camel@localhost>
On Wed, 2005-03-02 at 21:42 +0100, Denis Corbin wrote:
> -----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
> 
> ~         }


Ah, thanks! I thought I was missing something here.

> 
> |
> | 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
> _______________________________________________
> Dar-discussions mailing list
> Dar-discussions-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/dar-discussions
-- 
Wesley Leggette <lists-+42/j/[email protected]>



-------------------------------------------------------
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