a Big Number module and D China

BCS ao at pathlink.com
Sun Oct 14 06:33:15 PDT 2007


Reply to yidabu,

> BCS Wrote:
> 
>> actually I have an arbitrary static sized implementation in dsource
>> that does use ASM (x86 only) but it only works up to about 1000 bits
>> (I think, and that's old so who knows) before it crashes DMD
>> 
> I try yourt implementtation of Big Number,  I do know how to use a
> arbitrary size input number  like:
> 
> auto a = new
> Bignumber("12345678901234567890123456789012345678901234567890");
> 

My implementation uses binary directly so the best wat to set a value is 
to somehow covert the value to hex and then push that into the strut


BigNum!(8) bn;

bn.values = [ // set to 2^255 + 2^127
  0x8000_0000u,  //*2^224
  0x0,  //*2^192
  0x0,  //*2^160
  0x0,  //*2^128
  0x8000_0000u,  //*2^96
  0x0,  //*2^64
  0x0,  //*2^32
  0x0  //*2^0
  ];

> my dsource username is yidabu
> 


you are in





More information about the Digitalmars-d mailing list