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,76e8d825615718a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada.Containers Hash function for a set of small integers Date: Mon, 26 Apr 2010 14:37:08 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <50701baa-7c05-450c-a42d-c699516ddc00@t14g2000prm.googlegroups.com> <0590cf17-12ea-401d-9dc3-02365139b37e@p35g2000prf.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1272307014 6232 192.74.137.71 (26 Apr 2010 18:36:54 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 26 Apr 2010 18:36:54 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:nE5CQqBgCBiYSDMvCVUOOPGuTOI= Xref: g2news2.google.com comp.lang.ada:11189 Date: 2010-04-26T14:37:08-04:00 List-Id: Simon Wright writes: > type M is mod 2**31; > Result : M := 0; > begin > Result := Result xor Integer'Pos (I.A); > and, before anyone rushes to check it out, yes, it fails with negative > values and I'm about to file a bug against it. I don't think that's a compiler bug. Conversion of negative numbers to modular raises Constraint_Error. I think that's a language design flaw, but not everyone agrees with me. The 'Mod attribute works around the problem. - Bob