From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,442eb9212004f30 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!i76g2000hsf.googlegroups.com!not-for-mail From: micronian2@gmail.com Newsgroups: comp.lang.ada Subject: Re: Problem using Ada.Text_IO.Modular_IO Date: Thu, 17 Jul 2008 09:33:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: <745af312-8189-4ee3-ba43-0664e5891176@i76g2000hsf.googlegroups.com> References: <1215965011.20645.42.camel@K72> <5uyek.117084$102.99047@bgtnsc05-news.ops.worldnet.att.net> <93bcf03d-dd09-4cdd-b4a7-98bf56284ee3@k37g2000hsf.googlegroups.com> <3Ihfk.237474$SV4.171883@bgtnsc04-news.ops.worldnet.att.net> NNTP-Posting-Host: 199.46.200.231 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1216312425 24639 127.0.0.1 (17 Jul 2008 16:33:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Jul 2008 16:33:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i76g2000hsf.googlegroups.com; posting-host=199.46.200.231; posting-account=tXrPSAkAAAAFR3M1xqoK7TQdrNxOfPT0 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 webwasher (Webwasher 6.7.0.3295) Xref: g2news1.google.com comp.lang.ada:1195 Date: 2008-07-17T09:33:45-07:00 List-Id: Yes, I'm aware of the .S output. In my previous post, I was referring to the generated assembly code. Using (Value * 2**X) for shift left and (Value / 2**X) for right shift produced the same output as those predefined for Unsigned_N. --Micronian Coder On Jul 16, 12:47=A0am, a...@anon.org (anon) wrote: > In GNAT the types and functions define by packages "Standard.ads" and > some others like "Interfaces.ads" are treated as special. > > Note: In GNAT you will not see a package called "Standard" it > is built-into the compiler. =A0To check this package you can use > "-gnatS" (version GNAT 2005-8) in a command line. Such as: > > =A0 gnat1 adb -gnatS =A0>standard.ads > > As for the "Interfaces" package the compiler uses if possible a machine > instruction to preform the function. So, when the compile encounters a > call to the function "Rotate_Left" for example on a Intel cpu the > compiler will use the Intel processor instruction "rol". > > To see an example. Create a test program and compile it using either > the following commands. Two files are create (*.s, and *.ali). > > =A0 =A0gnat compile .adb =A0-S =A0 > > or > > =A0 =A0gnat1 .adb =A0 > > Note: the output of "GNAT1" when excuted by a command line/batch file > is normally a assembly source file for the target cpu with its assoc *.al= i > file. > > Then just check the file: .s > > Note: the "*.s" can be compiled and then you can use gnatbind/gnatlink > to continue to build the program. > > In <93bcf03d-dd09-4cdd-b4a7-98bf56284...@k37g2000hsf.googlegroups.com>, m= icroni...@gmail.com writes: > >On Jul 14, 6:12=3DA0am, Georg Bauhaus > >wrote: > >> anon schrieb: > >[snip] > >> Q: What routines does the compiler generate for Unsigned_64 > >> =3DA0 =3DA0 but not for "mod 2**64" and vice versa? > >> A: None. > > >Your "mod 2**64" won't get Shift_Arithmetic_Right, Rotate_Left, and > >Rotate_Right. After some thought, I realized that you can simulate > >Rotate_Left/Right with shift operations. For example, > >Rotate_Left(Value, 3) can be performed by doing: > > > Value :=3D3D (Value * 2**3) or (Value / 2**29) (note: assuming value is > >32-bits) > > >For constant values, the compiled output has a good chance of being > >the same for either "mod 2**64" and Unsigned_64. But what about cases > >where the shift offsets are not known at compile time? =A0I wrote two > >little test programs to see how user defined shift and rotate > >operations for "mod**64" compared to those that were predefined for > >Interfaces.Unsigned_64 using GNAT GPL2008. For the shift left/right > >operations, the output was the pretty much the same. For the rotate > >left/right, the ones for Unsigned_64 generated less code and did not > >need as many calls to the run-time system. Of course, this is all just > >based on one compiler. I don't know what other compilers do. Actually > >I do recall the old GreenHills AdaMULTI 3.0 compiler implemented the > >operations as calls to C functions. > > >Anyhow, I think I said enough on this. > >