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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f9957894e0bdf128 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 15 Jan 2009 08:34:36 -0600 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: How to put 200 into an integer sub-type of 16 bits (code included) Date: Thu, 15 Jan 2009 14:44:10 +0000 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <407ae64d-3cb3-4310-b59e-f1bbae9910a5@t39g2000prh.googlegroups.com> <71gqm49eatq868htrvd7eghm3m8su8kcbl@4ax.com> <7b017de2-951a-414a-8290-111353fe02f8@r15g2000prd.googlegroups.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-ZLBSpKj4tRYunK3gt7tpbug5scj1GDp5pa8bTeeB1FT5WX2ONvxmUpmcQya+YR+wHPRUOIFB80eSMIk!M+d88Sn1rZLxaWq9CgcS1Qmutj0iBQ9sIg1o38tWzMWXbbokl13BAeaDUQv9XW+I2ewJAw7789IC!ycaZ X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news2.google.com comp.lang.ada:4293 Date: 2009-01-15T14:44:10+00:00 List-Id: On Wed, 14 Jan 2009 13:09:50 -0800 (PST), 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). OK, I mistakenly thought you could apply 'size to a subtype of natural. Perhaps you can to a new type derived from it? I'll check later. Otherwise your modular type suggestion is best. >type Short is mod 256; >for Short'Size use 8; -- a confirming representation clause - Brian