comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Bit operators
Date: 2000/02/13
Date: 2000-02-13T00:00:00+00:00	[thread overview]
Message-ID: <48np4.505$e6.7474@newsread1.prod.itd.earthlink.net> (raw)
In-Reply-To: 884o85$jjv$1@news.fsu.edu

In article <884o85$jjv$1@news.fsu.edu> , grant@cs.fsu.edu (Joshua Grant) 
wrote:

> I was recently assigned a project for one of my classes that gave us the
> option of implementing a simplified MIPS assempler in any preferred higher
> level language.  I have choosen ADA, but I am running into a problem with
> the bit operators.  I can't find them!  In case someone isn't sure of my
> question.  In C++ if you perform an 'and' operation with the '&'
> operator like...
>
> 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;


> Can anyone tell me if ADA has an equivalent set of functions for 'and' and
> 'or'?  If you know please respond ASAP, I need to know if I should rewrite
> my project in a language that supports those operations.

Ada is a systems programming language, just like C/C++.  Anything you
can do in C, you can do in Ada.

Bitwise operators are predefined for modular types.  The operations are
named "and" and "or".

--
Celebrate Darwin Day on Saturday, 12 February!

<http://www.bbc.co.uk/education/darwin/index.shtml>




  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 ` Matthew Heaney [this message]
2000-02-13  0:00   ` Bit operators & asm in Ada (novice question) G
2000-02-13  0:00     ` Vladimir Olensky
2000-02-13  0:00     ` Gautier
2000-02-13  0:00 ` Bit operators Gautier
2000-02-13  0:00 ` 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