On Wed, 25 Aug 1999, John Marshall wrote:

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

I'm fairly new to this list.  Where is the archive?

I guess I was so focused on the palm data types that I forgot about the
native GCC data types.  I did not realize that there was a type for 64
bit integers in GCC.  Oh well, it's not the first time I've asked a
stupid question and it probably won't be the last.
 
> > Or is there an easier way? 
> 
> Make them enter the number in hex?  :-)

The point of my question was to have them enter Dec and calculate the
Hex value.  So, if they could enter in Hex, they would not need the
calculation:-)
 
>     John
> 
> 

----------------------------------------------------
Shoot-to-Win

Protect the 2nd Amendment
----------------------------------------------------

Reply via email to