Mike Davis writes:
> Is there a method (or algorigthm) for dealing with 64 bit integers 
> using only 32 bit data types?

Of course there is!  For what you want to do, you need to implement
modulus and division.  Modulus by a small divisor is easy, and the
algorithm for division is called "long division".  It's not a lot of fun,
but it's a lot easier in base 2 (or with numbers only 64/32 = two digits
long) than the general purpose base-10-arbitrarily-long-numbers algorithm
you learnt at primary school.  (There's sample code in libgcc2.c in the
GCC source code.)

> Remember I 
> can't use any * or / (on the entire number) since only 32 bit data 
> types and lower are available. 

Why not?  Can't you use the 64 bit operations supplied by your compiler?
(We covered this here only last month.  Use The Archives.)

> Or is there an easier way? 

Make them enter the number in hex?  :-)

    John

Reply via email to