From: micronian2@gmail.com
Subject: Re: Problem using Ada.Text_IO.Modular_IO
Date: Tue, 15 Jul 2008 23:16:32 -0700 (PDT)
Date: 2008-07-15T23:16:32-07:00 [thread overview]
Message-ID: <93bcf03d-dd09-4cdd-b4a7-98bf56284ee3@k37g2000hsf.googlegroups.com> (raw)
In-Reply-To: 487b50de$0$7537$9b4e6d93@newsspool1.arcor-online.net
On Jul 14, 6:12 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> anon schrieb:
[snip]
> Q: What routines does the compiler generate for Unsigned_64
> 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 := (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.
next prev parent reply other threads:[~2008-07-16 6:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-09 16:52 Problem using Ada.Text_IO.Modular_IO jujosei
2008-07-09 19:03 ` Anh Vo
2008-07-09 19:22 ` Adam Beneschan
2008-07-09 21:50 ` Adam Beneschan
2008-07-10 15:00 ` jujosei
2008-07-10 0:48 ` anon
2008-07-10 1:52 ` Adam Beneschan
2008-07-10 7:25 ` anon
2008-07-10 14:59 ` Adam Beneschan
2008-07-11 0:34 ` anon
2008-07-11 9:49 ` Georg Bauhaus
2008-07-11 10:05 ` christoph.grein
2008-07-11 13:21 ` John McCormick
2008-07-11 12:16 ` anon
2008-07-11 13:26 ` petter_fryklund
2008-07-11 21:10 ` anon
2008-07-12 10:06 ` Georg Bauhaus
2008-07-13 0:51 ` anon
2008-07-13 16:03 ` Georg Bauhaus
2008-07-14 2:03 ` anon
2008-07-14 13:12 ` Georg Bauhaus
2008-07-16 6:16 ` micronian2 [this message]
2008-07-16 7:47 ` anon
2008-07-17 16:33 ` micronian2
2008-07-14 16:34 ` micronian2
2008-07-14 17:26 ` Georg Bauhaus
2008-07-16 6:28 ` micronian2
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox