comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Newbie question: How does one do bit manipulation in Ada?
Date: 23 Dec 2003 04:09:21 -0500
Date: 2003-12-23T04:09:21-05:00	[thread overview]
Message-ID: <mailman.170.1072170574.31149.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <MPG.1a516ba5b76b5bee989684@news.sover.net>

Peter C.Chapin <pchapin@sover.net> writes:

> I'm a C/C++ programmer in the process of teaching myself Ada. I've been 
> writing toy programs to get a feeling for the language. There is 
> obviously a lot to learn, but I'm enjoying myself.

Good to hear!

> Anyway, I have a need to do some bit manipulations in one of my
> programs. In particular I want to invert certain bits in a number
> (integer). 

Others have told you how to do this using XOR.

I'd like to point out that Ada often has better ways to accomplish
things that are done with bit-fiddling in other languages. So if you
can explain why you need to invert those bits, we might be able to
give you a better way to accomplish the same thing.

For example, specifying the exact position of bits in registers is
much simpler in Ada than in C.

-- 
-- Stephe




  parent reply	other threads:[~2003-12-23  9:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-23  1:58 Newbie question: How does one do bit manipulation in Ada? Peter C. Chapin
2003-12-23  3:01 ` Georg Bauhaus
2003-12-23  3:23   ` Peter C. Chapin
2003-12-23  3:36     ` tmoran
2003-12-23  3:33 ` Steve
2003-12-23  9:09 ` Stephen Leake [this message]
2003-12-28 13:20   ` Peter C. Chapin
2003-12-28 18:40     ` Robert I. Eachus
2003-12-29  2:57       ` Peter C. Chapin
replies disabled

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