From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: logical operations in Ada
Date: 13 Feb 2001 23:11:05 +0100
Date: 2001-02-13T23:11:05+01:00 [thread overview]
Message-ID: <87lmrafd3a.fsf@deneb.enyo.de> (raw)
In-Reply-To: 96bro9$ivb$1@hobbes2.crc.com
"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:
> Here's an example of bit-wise operations on modular types
> with conversions to and from characters to do what you
> said you wanted to do.
Why are you using Ada.Unchecked_Conversion? In this case, it is
unnecessary (and unnecessary use of Ada.Unchecked_Conversion should be
avoided IMHO).
with Ada.Text_IO;
with Interfaces;
procedure Bit_Ops is
Mask : constant Interfaces.Unsigned_8 := 2#1101_1111#;
use type Interfaces.Unsigned_8;
begin
for C in CHARACTER'('a') .. CHARACTER'('z') loop
Ada.Text_IO.Put (Character'Val (Mask and Character'Pos (C)));
end loop;
Ada.Text_IO.New_Line;
end Bit_Ops;
prev parent reply other threads:[~2001-02-13 22:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-11 9:52 logical operations in Ada Freelancer
2001-02-11 12:24 ` David C. Hoos, Sr.
2001-02-11 12:59 ` Florian Weimer
2001-02-13 3:40 ` Freelancer
2001-02-13 6:43 ` Dale Stanbrough
2001-02-13 11:54 ` Jeff Creem
2001-02-13 17:44 ` David C. Hoos, Sr.
2001-02-13 22:11 ` Florian Weimer [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox