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!k37g2000hsf.googlegroups.com!not-for-mail From: micronian2@gmail.com Newsgroups: comp.lang.ada Subject: Re: Problem using Ada.Text_IO.Modular_IO Date: Tue, 15 Jul 2008 23:16:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: <93bcf03d-dd09-4cdd-b4a7-98bf56284ee3@k37g2000hsf.googlegroups.com> References: <1215965011.20645.42.camel@K72> <5uyek.117084$102.99047@bgtnsc05-news.ops.worldnet.att.net> <487b50de$0$7537$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Host: 71.108.122.117 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1216188993 29520 127.0.0.1 (16 Jul 2008 06:16:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 Jul 2008 06:16:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k37g2000hsf.googlegroups.com; posting-host=71.108.122.117; 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) Xref: g2news1.google.com comp.lang.ada:1167 Date: 2008-07-15T23:16:32-07:00 List-Id: 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.