Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!bloom-beacon!deccrl!news.crl.dec.com!pa.dec.com!shodha.enet.dec.com!widgit.enet.dec.com!west From: west@widgit.enet.dec.com (Jim West (Stealth Contractor)) Newsgroups: comp.lang.ada Subject: Re: Question with setting sign bit Message-ID: <2106@shodha.enet.dec.com> Date: 6 Dec 90 13:12:40 GMT Sender: news@shodha.enet.dec.com Distribution: usa Organization: Digital Equipment Corporation Lines: 43 In article <18172@hydra.gatech.EDU>, ms33@prism.gatech.EDU (Mike Sullivan, a.k.a. Sully) writes... > > I have a problem setting the sign-bit in an integer while trying to > explicitly set particular bits (as opposed to storing a negative > value.) The problem seems to caused by the strong typing of Ada in > conjunction with a limitation of the compilor. Ada wants me to use > unsigned integers. The compilor I use does not have unsigned integers > because the processor does not support unsigned arithmetic. I have > words that are coming off of a 1553 bus, and a general-purpose package > passing the information on to me. I want to see if some bits are set, > or not set as the case may be. There is different situation where I > Have you considered using a bit array ? I've done this many times. I find it far easier to do bit twiddling this way. An example would look something like : array_size : constant := 15 type bit is range 0 .. 1; for bit'size use 1; type data_type is array (0 .. array_size) of bit; pragma pack (data_type); data : data_type; You could then use this in conjunction with a for-use-at clause and lay the array on top of a record, or any other data type for manipulation. -=> Jim <=- ---------------------------------------------------------------------- Jim West | The Schainker Converse west@widgit.enet.dec.com | to Hoare's Law : | These are my opinions. | Inside every small problem Digital has no idea | is a larger problem struggling what I'm saying. | to get out. ---------------------------------------------------------------------- Brought to you by Super Global Mega Corp .com