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,78ec96be17741f16 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Unclear error message - please help Date: Mon, 10 Oct 2005 18:49:24 +0200 Organization: Cablecom Newsserver Message-ID: <7584946.OpPvqevNQa@linux1.krischik.com> References: <432C8690.C37D4AE0@alfred-hilscher.de> <43482077.3434FCF3@alfred-hilscher.de> <4894486.ZC6T0HgaI8@linux1.krischik.com> NNTP-Posting-Host: 84-73-3-231.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1128963603 4157 84.73.3.231 (10 Oct 2005 17:00:03 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Mon, 10 Oct 2005 17:00:03 +0000 (UTC) User-Agent: KNode/0.9.2 Xref: g2news1.google.com comp.lang.ada:5536 Date: 2005-10-10T18:49:24+02:00 List-Id: Brian May wrote: >>>>>> "Martin" == Martin Krischik writes: > > Martin> A "range 0..65535" needs 17 bits and an "is Integer" is > Martin> usually 32 bit. > > Martin> See > > Martin> http://en.wikibooks.org/wiki/Ada_Programming/Types/range > Martin> http://en.wikibooks.org/wiki/Ada_Programming/Types/mod > > Martin> for more info. > > I read the above links but didn't see why a range 0..65535 requires 17 > bits. All range types alow for positive and negative values - even when the subtype is restricted to a positive range - so they need a sign bit. That means the compiler needs to support: X : Sixteen_Bits'Base := - 65535; Most likely Sixteen_Bits'Base'Size will be 32 bit. Others pointed out that you can request the data to be packed - which slipped my mind when I was writing the post - sorry about that. In fact you can pack a range 1000 .. 1255 into 8 bit if you want to. So I stand corrected in that you need only need 16 after all. However data which has been packed need to be unpacked to do anything usefull with them. Performance depends on how well the compiler will handle the packing/unpacking. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com