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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8b01e86b2d0a470 X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: how to do bit-wise operation on none modular types? Date: 1999/03/03 Message-ID: <7bk1kr$j31$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 450838002 References: <7bj7ti$4i@drn.newsguy.com> <7bjjck$25t7@news1.newsguy.com> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Mar 03 19:13:41 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-03-03T00:00:00+00:00 List-Id: In article <7bjjck$25t7@news1.newsguy.com>, Samuel Mize wrote: > Bill, > > If your status is a positive number, Tucker's answer is good. (Of course.) > > If not -- for instance, if it's a bitmap of status values and the sign > bit is used -- you'll have to use unchecked conversion. Make sure the > unsigned type and the signed type are the same size, and use an instance > of Unchecked_Conversion to convert the signed type to the modular type. If this value comes directly from a "pragma import"ed routine, you have another option. Just change the type of the parameter to a type that would work better for you (modular integer, packed array of boolean, whatever). Just make sure the type is the same size as C's "int". Putting a 'size clause on the type's declaration will enforce this by causing a compilation error when it won't fit. > Some people prefer to convert to a packed array of booleans if they're > working with a boolean bitmap, as they feel it makes the rest of the > code clearer. I'm definitely one of those. I just showed a developer here how to do that this morning. Being an old Fortran guy, he liked it better than how C had him do it, because it resembled the "btest" call he used to make in Fortran. T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own