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,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Mon, 09 Aug 2010 09:28:02 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1jmwhfp.roo31ybayx2bN%csampson@inetworld.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1281360466 31955 192.74.137.71 (9 Aug 2010 13:27:46 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 9 Aug 2010 13:27:46 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:+SkxCkfrSJpcdhaPUcFh8hAlZVA= Xref: g2news1.google.com comp.lang.ada:12979 Date: 2010-08-09T09:28:02-04:00 List-Id: "J-P. Rosen" writes: > Robert A Duff a �crit : >> P.S. Can anybody recall the definition of "not" on modular >> types, when the modulus is not a power of 2, without >> looking it up? > Sure. Like any other operation. First you do the operation in the > mathematical sense, then you take the mathematical result mod T'Modulus. "and", "or", and "xor" are defined that way (bit-wise logical operation, followed by "mod"). "not" is NOT defined as bit-wise "not" followed by "mod". type T is mod 3; X : T := 2; ... X := not X; Now X = 0. 2 = 2#10#. Bit-wise "not" of that is 2#01#. "mod" that by 3, and you get 2#1#. >> Hint: It makes no sense. > It makes sense because it is consistent with all other operations on > modular types. Whether it is usefule is another story ;-) It is neither consistent nor useful. I'll stick with "makes no sense". >> The only feature >> that's worse than "modular types" is "modular types with a >> non-power-of-2 modulus". ;-) > Hmmm... Hash coded tables? Signed integers work fine for that. Except when you need that one extra bit -- that's the problem. - Bob