home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!noc.near.net!inmet!spock!stt
- From: stt@spock.camb.inmet.com (Tucker Taft)
- Subject: Re: FORTRAN bug(was Re: C++ vs. Ada -- Is Ada loosing?)
- Message-ID: <1992Dec11.232231.7032@inmet.camb.inmet.com>
- Sender: news@inmet.camb.inmet.com
- Nntp-Posting-Host: spock
- Organization: Intermetrics Inc, Cambridge MA
- References: <1992Dec11.163811@lglsun.epfl.ch> <1992Dec11.210404.2480@inmet.camb.inmet.com> <19921211.142820.329@almaden.ibm.com>
- Date: Fri, 11 Dec 1992 23:22:31 GMT
- Lines: 50
-
- In article <19921211.142820.329@almaden.ibm.com>
- jnestoriak@vnet.ibm.com (John Nestoriak III) writes:
-
- >In <1992Dec11.210404.2480@inmet.camb.inmet.com> Tucker Taft writes:
-
- >>One of our goals for Ada 9X has been to give system programmers
- >>back this feeling of satisfaction, so that you can do "code generation
- >>in your head" for most Ada constructs. In other words,
- >>you can predict about how many machine instructions (and
- >>generally which ones ;-) will be generated for each
- >>construct in your program. For a real-time embedded language,
- >>this seems particulary important.
- >
- >Are there plans to add bitwise operations to Ada 9X? Lack of
- >built in shift operators was a disappointing discovery for me.
- >I know that Ada is a high order language and therefor less suitable
- >for manipulating bits than say C, but there are high level functions
- >that need to manipulate bits. I'm thinking in particular of
- >compression routines. The project I work on is Ada but we had to
- >implement compression using C.
-
- Yes. We are planning to add "modular types" to Ada 9X,
- which are unsigned, wrap-around types with a user-specified
- modulus (normally a power-of-2). These types will have +/-, etc.,
- bit-wise and, or, xor, and not, as well as a language-defined
- generic package that provides shift operations. This
- package is intended to be recognized by the compiler, so
- that these shift operations result in inline machine instructions for
- shifting.
-
- Here is the tentative syntax:
-
- type Unsigned_16 is mod 2**16; -- declare a 16-bit unsigned type
-
- package Shift_16 is new System.Shifts(Unsigned_16); use Shift_16;
- -- Get the shift functions
- X : Unsigned_16 := 16#00FF#;
- Y, Z : Unsigned_16;
- begin
- Y := Left_Shift(X, 5); -- Try them out
- Z := X and Y;
- if Z /= 16#00E0# then
- Put_Line("Send the 9X compiler back"); -- ;-)
-
- etc...
-
- S. Tucker Taft stt@inmet.com
- Ada 9X Mapping/Revision Team
- Intermetrics, Inc.
- Cambridge, MA 02138
-