[comp.lang.c] C compiler with 64-bit ints??

cjc@ulysses.homer.nj.att.com (Chris Calabrese) (11/09/89)

In article <6405@jpl-devvax.JPL.NASA.GOV>, bruce@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@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@ulysses.att.com
Obligatory Quote:	``Anyone who would tell you that would also try and sell you the Brooklyn Bridge.''

daveg@near.cs.caltech.edu (Dave Gillespie) (11/10/89)

In article <6405@jpl-devvax.JPL.NASA.GOV>, bruce@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? ...

Doesn't gcc (the GNU C compiler) have a "long long" type for 64-bit ints?
I can't find it in the documentation, but I've seen it used.
--
Dave Gillespie
  256-80 Caltech Pasadena CA USA 91125
  daveg@csvax.caltech.edu, cit-vax!daveg

gerry@zds-ux.UUCP (Gerry Gleason) (11/11/89)

In article <12376@ulysses.homer.nj.att.com> cjc@ulysses.homer.nj.att.com (Chris Calabrese) writes:
>In article <6405@jpl-devvax.JPL.NASA.GOV>, bruce@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

>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

Not 64-bit ints, 64-bit integers whose type would be long.  He is looking
for a compiler that does this, a reasonable thing, that same thing as
a compiler for a 16-bit system that has 32-bit longs.

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

Any code that assumes this is broken already, besides, he is asking for
a tool to be applied to a new problem.

Gerry Gleason