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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8af7fe40dc0a55ae X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!l33g2000pri.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Restarting Tread: Why isn't this program working with Unchecked_Converstion Date: Fri, 16 Jan 2009 09:26:25 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <83d19cd8-71ca-43c1-a3eb-05832290e565@r36g2000prf.googlegroups.com> <40239b21-b265-467f-9b27-5890fb2f4c67@w1g2000prm.googlegroups.com> <5df15a77-b654-41da-bea0-a799f4cb6230@v13g2000yqm.googlegroups.com> <9069fcf7-4257-4439-ad4a-8d7c8c17f5cf@v5g2000pre.googlegroups.com> <70172b19-360c-4eba-815c-ede747c3bcdf@w39g2000prb.googlegroups.com> NNTP-Posting-Host: 81.156.241.243 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1232126785 13787 127.0.0.1 (16 Jan 2009 17:26:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 16 Jan 2009 17:26:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l33g2000pri.googlegroups.com; posting-host=81.156.241.243; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:4363 Date: 2009-01-16T09:26:25-08:00 List-Id: On Jan 16, 5:08=A0pm, ChristopherL wrote: > On Jan 16, 7:11=A0am, Ludovic Brenta wrote: > > > =A0 =A0type Signed_8 is range - 2**7 .. 2**7 - 1; > > =A0 =A0for Signed_8'Size use 8; > > I didn't use the second line in my program! Without it, my system > uses 10 bits for this. I'm going to use my solution for now. > > Also experimenting on my own, if I only make the below change the > variable Result has a value of -62 and not as above (-56). > > -- =A0type Short_integer1 is range 0.. ((2 ** 8) - 1); > -- =A0for Short_Integer1'Size use 8; > > =A0 type Short_integer1 is mod 2 ** 8; > =A0 for Short_Integer1'Size use 8; > > What does the following line of code do? It's new to me and have to > know! > > type Short_integer1 is mod 2 ** 8; > > Chris L. "mod" indicates a 'modular' type - i.e. unsigned, with wrap-round semantics (no exceptions). Analogous to C 'unsigned'. Useful for masking - using 'and', 'or', etc. If you want an unsigned 8-bit integer with those semantics, you can use the predefined type Interfaces.Unsigned_8. The package 'Interfaces' name indicates that you are 'close to the metal' in some why and you actually _care_ about the size of objects your manipulating. There is a very good Wikibook on Ada you know... http://en.wikibooks.org/wiki/Ada_Programming and in particular: http://en.wikibooks.org/wiki/Ada_Programming/Types/mod Cheers -- Martin