C compiler with 64-bit ints??

Chris Calabrese cjc at ulysses.homer.nj.att.com
Fri Nov 10 01:07:56 AEST 1989


In article <6405 at jpl-devvax.JPL.NASA.GOV>, bruce at pituco.JPL.NASA.GOV (Bruce McLaughlin) writes:
> Does anyone know of a C compiler which runs on Sun workstations (68020/30)
> running 4.0.3 which supports 64-bit integers in a native-type mode?  We have
> some users here who would like to use normal math type functions (+-*/)
> on 64-bit integers (i.e., nothing fancy like trig) that works FAST.  They
> have run some preliminary tests using the multiple precision math library
> [mp(3X)] and find that it's way too slow.  They are trying to port some code
> from a Univac computer which supports 64-bit ints.  They could write some
> specific asm routines and use function calls, but would prefer the code to
> look like normal math.  (Some people are just picky that way!  :-)
> 
> --Bruce McLaughlin
> bruce at pituco.jpl.nasa.gov
> ...cit-vax!elroy!jpl-devvax!pituco!bruce


Hmm, this seems like some thing which be difficult in C because it
would require modifying the compiler to use 64 bit ints, and there's
no really good hardware support for it anyway.  It would also cause
problems when linking with modules compiled under the normal compiler
(like the shared libraries!) and would break any code which assumes
that long==int==32 bits.

The problem with the multiple precision library is probably the
overhead in making the function calls, etc.  This leads me to believe
that the way to go is to use C++, which will allow you to define a new
data type which has all the normal math operations and expands the
code inline, which should be plenty fast if your C compiler generates
tight code (gcc would be useful here).

I'd ask if anyone cares to comment, but I don't really have to on the
net :-).
-- 
Name:			Christopher J. Calabrese
Brain loaned to:	AT&T Bell Laboratories, Murray Hill, NJ
att!ulysses!cjc		cjc at ulysses.att.com
Obligatory Quote:	``Anyone who would tell you that would also try and sell you the Brooklyn Bridge.''



More information about the Comp.lang.c mailing list