home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3629 < prev    next >
Encoding:
Text File  |  1992-12-11  |  2.5 KB  |  63 lines

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