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,f9957894e0bdf128 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!v18g2000pro.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How to put 200 into an integer sub-type of 16 bits (code included) Date: Wed, 14 Jan 2009 13:16:32 -0800 (PST) Organization: http://groups.google.com Message-ID: <46075a57-3445-44ae-b40e-dcad9e0e1fcf@v18g2000pro.googlegroups.com> References: <407ae64d-3cb3-4310-b59e-f1bbae9910a5@t39g2000prh.googlegroups.com> <71gqm49eatq868htrvd7eghm3m8su8kcbl@4ax.com> <7b017de2-951a-414a-8290-111353fe02f8@r15g2000prd.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1231967792 17295 127.0.0.1 (14 Jan 2009 21:16:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 14 Jan 2009 21:16:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v18g2000pro.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:3297 Date: 2009-01-14T13:16:32-08:00 List-Id: On Jan 14, 1:09 pm, sjw wrote: > On Jan 14, 1:33 am, Brian Drummond > wrote: > > > If you need to put 200 in an 8-bit type, why not use > > Natural range 0 to 255? > > Natural range has the same number of bits as Integer, which > has to be at least 16 and is very likely to be 32 (or maybe 64 on a 64- > bit machine). Not necessarily. You can apply a 'Size clause to a subtype: subtype Byte is Natural range 0 .. 255; for Byte'Size use 8; -- Adam