comp.lang.ada
 help / color / mirror / Atom feed
From: G <gmw@interact.net.au>
Subject: Re: Bit operators & asm in Ada (novice question)
Date: 2000/02/13
Date: 2000-02-13T00:00:00+00:00	[thread overview]
Message-ID: <38A624B3.5709A464@interact.net.au> (raw)
In-Reply-To: 48np4.505$e6.7474@newsread1.prod.itd.earthlink.net




>
> > base 10
> > 1 = 1 & 3
> > 3 = 3 & 3
> > 2 = 6 & 3
> > 3 = 7 & 3
>
> declare
>   I : Interfaces.Unsigned_32;
> begin
>   I := 1 and 3;
>   I := 3 and 3;
> etc
> end;
>
> > base 2 (same as above)
> > 001 = 001 & 011
> > 011 = 011 & 011
> > 010 = 110 & 011
> > 011 = 111 & 011
>
> declare
>   I : Interfaces.Unsigned_32;
> begin
>   I := 2#110# and 2#011#;
>   I := 2#111# and 2#011#;
> etc
> end;
>
>
>
> Ada is a systems programming language, just like C/C++.  Anything you
> can do in C, you can do in Ada.
>

  I have been reading the Art of Assembly.  I was wondering how to do exactly
these sorts of operations in Ada.  If my terminology is correct, and from what
is above, I am
thinking that I can apply bit masks to bytes by using modular integers (OR by
declaring a variable as Interface.Unsigned_32,( for 32bit ops only, I assume -
and that modular integers would allow for contraction to 16 or 8 and rotation or
shift operations ???)).  So -
in Borland C++ I may actually write asm directly into code (not that I can yet),

but - is this possible in Ada ?
  I have read many times and in many places that actual running programs spend
on average 90% of their time in 10% of the code.  And that assembly is often
employed to
rewrite that 10%.  I guess what I am wondering is, how does an assembly
programmer do this if a program has been written for Ada ?  Does the Ada
programmer have to construct their programs with a preconceived notion that it
will have to be rewritten in parts in Assembly ?  Or is it that at the machine
level these sorts of questions are totally irrelevant.  I wonder because it is
not at all transparent.

--

--
GM Wallace.

BDF
--
caveat: I can not afford a computer science education, please do not flame me.
(I received some nasty, almost threatening, messages a while back from someone
(anonymous) here so I feel I have to qualify my ignorance very cautiously).





  reply	other threads:[~2000-02-13  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-12  0:00 Bit operators Joshua Grant
2000-02-13  0:00 ` Gautier
2000-02-13  0:00 ` Matthew Heaney
2000-02-13  0:00   ` G [this message]
2000-02-13  0:00     ` Bit operators & asm in Ada (novice question) Vladimir Olensky
2000-02-13  0:00     ` Gautier
2000-02-13  0:00 ` Bit operators Robert Dewar
2000-02-13  0:00   ` Gautier
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox