home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!parsifal.umkc.edu!vax1.umkc.edu!khill
- Newsgroups: comp.lang.c++
- Subject: Re: Efficient 64-bit integer arithmetic
- Message-ID: <1992Jul25.071552.1@vax1.umkc.edu>
- From: khill@vax1.umkc.edu
- Date: Sat, 25 Jul 1992 13:15:52 GMT
- Sender: root@parsifal.umkc.edu (Parsifal Administration)
- References: <711997458snx@trmphrst.demon.co.uk>
- Organization: University of Missouri - Kansas City
- Lines: 32
-
- In article <711997458snx@trmphrst.demon.co.uk>, nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
- > I need to implement efficient 64-bit signed integer arithmetic in C++ (or C)
- > on a machine with a 32-bit long (actually, 60 significant bits + sign
- > would do fine).
- >
- > I need addition, subtraction, multiplication, division, remainder, and
- > efficient multiply and divide by 10 (for conversion to/from strings).
- >
- > I have looked at the bignum package, which implements arbitrary precision,
- > but I feel the extra constraint of having only 60 significant bits should
- > enable a much more efficient implementation to be possible.
- >
- > Does anyone know of any such code available for anonymous ftp ? Or have
- > any suggestions ?
-
- I do not have any code to offer, at this time, but I do have a suggestion.
- Isn't the idea of doing 64 bit arithmetic on a 32 bit machine the same question
- as doing 32 bit arithmethic on a 16 bit machine? I mean, if you did a straight
- search/replace on all the 16 bit instructions and replaced them with 32 bit
- instructions would this not be a REASONABLY (not neccesarily the best)
- efficient routine. After all, the mathematics would not be changing, just the
- base of the arithmetic.
- --
- ===============================================================================
- ! Ken Hill ! This message is SHAREWARE. You are authorized !
- ! -------- ! to use this message for up to 5 days. If you !
- ! KHILL@VAX1.UMKC.EDU ! like what you see please register it by sending !
- ========================! a response. This message may be freely distributed !
- ! Amateur Mathematician ! in its original and unmodified form. Remember only !
- ! Professional Paperboy ! you can support SHAREWARE. (c) 1992 Ken Hill :> !
- ===============================================================================
- This message has been brought to you by the letter Q and the number 7
-