comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: bitwise comparators
Date: 2000/01/16
Date: 2000-01-16T00:00:00+00:00	[thread overview]
Message-ID: <5j9g4.1718$%Y3.105022@newsread2.prod.itd.earthlink.net> (raw)
In-Reply-To: 3880D375.7E363123@hotmail.com

In article <3880D375.7E363123@hotmail.com> , Alexander Van Hecke 
<alexke@hotmail.com>  wrote:

> I want to do the following :
> OK_to_proceed : BOOLEAN := FALSE;
> data : Unsigned_8;
>
> while (not OK_to_proceed) loop
>     -- do stuff
>     OK_to_proceed := (data BITWISE AND 2#1#);
> end loop;
>
> so I want to exit the loop if bit one of data is set, but I don't know
> what the bitwise and is!

The bitwise and for modular types is "and".

Don't use the while form of loop; your version requires mental
gymnastics to figure out.  If you want to "exit the loop if bit one of
data is set," then say that directly:

loop
  -- do stuff
  exit when (data and 2#1#) > 0;
end loop;

You also have to be careful what you mean by "bit one".  Are you
referring to the bit that corresponds to the value of 2**0, or 2**1?
Your original example uses 2#1#, which I would probably describe as the
"bit zero."

--
Time and again the nation's courts have ruled that creationism, as a
religious dogma, cannot be taught in science classes. Now, creationists
are advancing a new tactic: eliminating the teaching of evolution and
other sciences that complement evolution, such as geology, paleontology,
and biological anthropology. By doing so, they are not only endangering
church-state separation but also seriously jeopardizing the science
education of future generations.

http://www.campusfreethought.org/sos/




  parent reply	other threads:[~2000-01-16  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-15  0:00 bitwise comparators Alexander Van Hecke
2000-01-15  0:00 ` David C. Hoos, Sr.
2000-01-16  0:00 ` DuckE
2000-01-17  0:00   ` Alexander Van Hecke
2000-01-17  0:00     ` Jeff Carter
2000-01-17  0:00       ` Alexander Van Hecke
2000-01-17  0:00         ` Gautier
2000-01-17  0:00           ` Alexander Van Hecke
2000-01-17  0:00             ` David Starner
2000-01-18  0:00             ` Gautier
2000-01-18  0:00           ` Ted Dennison
2000-01-17  0:00         ` David Starner
2000-01-17  0:00           ` Alexander Van Hecke
2000-01-17  0:00             ` David Starner
2000-01-18  0:00             ` Preben Randhol
2000-01-18  0:00             ` Fraser
2000-01-18  0:00               ` Bertrand Augereau
2000-01-19  0:00                 ` Ted Dennison
2000-01-19  0:00                   ` Marin D. Condic
2000-01-19  0:00                     ` Ted Dennison
2000-01-18  0:00           ` Ted Dennison
2000-01-18  0:00         ` Pascal Obry
2000-01-18  0:00         ` Jeff Carter
2000-01-18  0:00           ` Keith Thompson
2000-01-19  0:00             ` Jeff Carter
2000-01-19  0:00               ` Keith Thompson
2000-01-19  0:00               ` David Starner
2000-01-19  0:00             ` Ole-Hjalmar Kristensen
2000-01-19  0:00             ` Gisle S�lensminde
2000-01-21  0:00         ` Ada vs. C/C++ (was re: bitwise something-or-other) Mark Lundquist
2000-01-21  0:00           ` Mark Lundquist
2000-01-24  0:00           ` Hyman Rosen
2000-01-17  0:00     ` bitwise comparators David C. Hoos, Sr.
2000-01-17  0:00     ` Gautier
2000-01-18  0:00       ` Keith Thompson
2000-01-19  0:00         ` Ole-Hjalmar Kristensen
2000-01-17  0:00     ` Matthew Heaney
2000-01-17  0:00     ` tmoran
2000-01-17  0:00     ` Mike Silva
2000-01-17  0:00       ` Brian Rogoff
2000-02-05  0:00         ` Ashley Deas Eachus
2000-02-05  0:00           ` Jeff Carter
2000-02-06  0:00           ` Andy
2000-02-07  0:00           ` Brian Rogoff
2000-02-09  0:00             ` Robert Iredell Eachus
2000-01-17  0:00       ` Alexander Van Hecke
2000-01-17  0:00         ` Mike Silva
2000-01-18  0:00           ` Charles Hixson
2000-01-17  0:00         ` Gautier
2000-01-17  0:00         ` David Starner
2000-01-18  0:00     ` DuckE
2000-01-18  0:00     ` Ted Dennison
2000-01-16  0:00 ` Matthew Heaney [this message]
2000-01-16  0:00 ` Bryce Bardin
2000-01-16  0:00 ` Jeff Carter
replies disabled

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