[comp.lang.ada] Need 64 bit integers on VAX

arny@wayback.UUCP (Arny B. Engelson) (01/28/88)

We are using VAX Ada and need to store 64 bit integer numbers.  Since an
Integer is 32 bits, we have a problem.  For reasons I won't go into,
Floating and Fixed point representations are out.

Is using something like Unsigned_Quadword, and overloading the arithmetic
operators, the way to go?  Has someone already coded these routines?

Any solution has to allow normal arithmetic operations and I/O capabilities.
It has to look and feel, to the user, like an integer.

What solutions have people come up with to this type of problem?

Arny Engelson
ihnp4!wayback!arny  or  ucbvax!clyde!wayback!arny

wes@obie.UUCP (Barnacle Wes) (02/04/88)

In article <1234@wayback.UUCP>, arny@wayback.UUCP (Arny B. Engelson) writes:
> 
> Is using something like Unsigned_Quadword, and overloading the arithmetic
> operators, the way to go?  Has someone already coded these routines?

Yes, this is the way to go, that's why the features were put into the
language.  The problem with doing a good generic package in Ada is
that it takes time, and on a "quickie" program you don't have the time
available.

I've got some pretty generic code around here somewhere for doing 64
bit ints in C, which you could probably convert to Ada and overload as
operators.  That assumes, of course, that you know C.

(My only hands-on experience with Ada overloading was a package I
wrote to handle 48-bit binary numbers as characters for a program that
decoded messages on a DoD embedded network.  The package wasn't in the
version that got qualified and shown to the world, unfortunately.)

-- 
	{backbones}!utah-cs!utah-gr!uplherc!sp7040!obie!wes

	"Against Stupidity, The Gods Themselves Contend in Vain."
							-- Asimov

djs@actnyc.UUCP (Dave Seward) (02/11/88)

In article <31@obie.UUCP> wes@obie.UUCP (Barnacle Wes) writes:
>In article <1234@wayback.UUCP>, arny@wayback.UUCP (Arny B. Engelson) writes:
>> Is ... overloading the arithmetic
>> operators, the way to go?
>Yes, this is the way to go, that's why the features were put into the
>language.

I agree with Mr. Wes, but add that VMS has RTL (run time library) callable
routines giving access to the VAX 64 bit arithmetic instructions, so that
one could write an Ada package providing this ability without having to
actually code the arithmetic operations themselves.

Dave Seward.
InterACT Corp.
uunet!actnyc!djs

wes@wsccs.UUCP (Barnacle Wes) (02/20/88)

In article <691@actnyc.UUCP>, djs@actnyc.UUCP (Dave Seward) writes:
> I agree with Mr. Wes, but add that VMS has RTL (run time library) callable
> routines giving access to the VAX 64 bit arithmetic instructions, so that
> one could write an Ada package providing this ability without having to
> actually code the arithmetic operations themselves.

Good tip, Dave; if I had known about the VAX 64-bit integer routines in the
RTL, I would have suggested the same thing.  My first Ada program had import
pragmas so I could use QIO's for direct terminal I/O.  It was really very
easy to do, I used the sources for the Ada RTL routine (which are written
in BLISS, of course :-) ) import pragmas as an example.

-- 
    /\              - " Against Stupidity,  -    {backbones}!
   /\/\  .    /\    -  The Gods Themselves  -  utah-cs!utah-gr!
  /    \/ \/\/  \   -   Contend in Vain."   -  uplherc!sp7040!
 / U i n T e c h \  -        Schiller       -     obie!wes

terry@wsccs.UUCP (terry) (02/27/88)

In article <691@actnyc.UUCP>, djs@actnyc.UUCP (Dave Seward) writes:
> I agree with Mr. Wes, but add that VMS has RTL (run time library) callable
> routines giving access to the VAX 64 bit arithmetic instructions, so that
> one could write an Ada package providing this ability without having to
> actually code the arithmetic operations themselves.

	It also has the advantage of making your program only run on DEC
VMS stuff, the same as it does in any other language on a VMS system.  Better
to use the normal stuff.

	I know Wes, and it's his first name :-).


| Terry Lambert           UUCP: ...!decvax!utah-cs!century!terry              |
| @ Century Software       or : ...utah-cs!uplherc!sp7040!obie!wsccs!terry    |
| SLC, Utah                                                                   |
|                   These opinions are not my companies, but if you find them |
|                   useful, send a $20.00 donation to Brisbane Australia...   |
| 'There are monkey boys in the facility.  Do not be alarmed; you are secure' |