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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Problem using Ada.Text_IO.Modular_IO Reply-To: no to spamers (No@email.given.org) References: <1215965011.20645.42.camel@K72> <5uyek.117084$102.99047@bgtnsc05-news.ops.worldnet.att.net> <93bcf03d-dd09-4cdd-b4a7-98bf56284ee3@k37g2000hsf.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: <3Ihfk.237474$SV4.171883@bgtnsc04-news.ops.worldnet.att.net> Date: Wed, 16 Jul 2008 07:47:11 GMT NNTP-Posting-Host: 12.64.12.186 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1216194431 12.64.12.186 (Wed, 16 Jul 2008 07:47:11 GMT) NNTP-Posting-Date: Wed, 16 Jul 2008 07:47:11 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:1171 Date: 2008-07-16T07:47:11+00:00 List-Id: 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. To check this package you can use "-gnatS" (version GNAT 2005-8) in a command line. Such as: gnat1 adb -gnatS >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). gnat compile .adb -S or gnat1 .adb 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 *.ali 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-98bf56284ee3@k37g2000hsf.googlegroups.com>, micronian2@gmail.com writes: >On Jul 14, 6:12=A0am, Georg Bauhaus >wrote: >> anon schrieb: >[snip] >> Q: What routines does the compiler generate for Unsigned_64 >> =A0 =A0 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 :=3D (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? I 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. >