From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd45e29f9dafca87 X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: bitwise comparators Date: 2000/01/16 Message-ID: <85r3qd$ggu$1@nnrp1.deja.com>#1/1 X-Deja-AN: 573152436 References: <3880D375.7E363123@hotmail.com> X-Http-Proxy: 1.0 x25.deja.com:80 (Squid/1.1.22) for client 205.188.199.168 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sun Jan 16 00:36:30 2000 GMT X-MyDeja-Info: XMYDJUIDjrcarter001 Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; AOL 5.0; Windows 95; DigExt; Freei Client 2.1) Date: 2000-01-16T00:00:00+00:00 List-Id: In article <3880D375.7E363123@hotmail.com>, Alexander Van Hecke wrote: > hello, > > 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! If Unsigned_8 is a modular type, such as Interfaces.Unsigned_8, then the operator "and" performs a bitwise and between values of the type: Data and 1 The result of this is of type Unsigned_8. You have a number of options to convert this to Boolean: OK_To_Proceed := Boolean'Val (Data and 1); is probably the best. Others include comparing the result to 1 (OK) and using an unchecked conversion (not recommended). I think that loop exit when OK_To_Proceed; is easer to read and understand than the negative logic used with a while loop. -- Jeff Carter "Now go away or I shall taunt you a second time." -- Monty Python and the Holy Grail Sent via Deja.com http://www.deja.com/ Before you buy.