a Big Number module

yidabu yidabu.nospam at gmail.com
Sun Nov 4 18:08:59 PST 2007


Bill Baxter Wrote:

> yidabu wrote:
> > bearophile Wrote:
> > 
> >> Nice. Can it made to work with Phobos alone too?
> >>
> >> Maybe the function bigintLLCountOnes() can be speed up with this:
> >>
> >> /*********************************
> >> Quickly return the number of set bits in the given uint
> >> (functions similar to this one can work on 64 bits too).
> >> */
> >> int countBitUint(TyNumber)(TyNumber v) {
> >>     // This templating trick is useful to avoid processing ulongs
> >>     static if( is(TyNumber == uint) ) {
> >>         v = v - ((v >> 1) & 0x55555555);    // reuse input as temporary
> >>         v = (v & 0x33333333) + ((v >> 2) & 0x33333333);        // temp
> >>         return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count
> >>     } else
> >>         assert(false, "countBitUint() works only with uint, not with " ~ typeid(TyNumber).toString);
> >> }
> >>
> >> Bye,
> >> bearophile
> > 
> > Thanks!
> > 
> > since Phobos is dead end, I not use it if possible.
> > 
> 
> It *was* a dead end.  But now it's back and under new management.  So 
> there's hope yet. ... er except if you mean D1.x.  Then yeh, Phobos is a 
> dead end.
> 
> --bb


I hope Phobos 2.X open the door to Tango team, if it is not a dead end.




More information about the Digitalmars-d mailing list