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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.32.1 with SMTP id e1mr14533668obi.11.1408969202287; Mon, 25 Aug 2014 05:20:02 -0700 (PDT) X-Received: by 10.140.31.73 with SMTP id e67mr216qge.30.1408969202256; Mon, 25 Aug 2014 05:20:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!uq10no4775503igb.0!news-out.google.com!j6ni7969qas.0!nntp.google.com!i13no2718923qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 25 Aug 2014 05:20:02 -0700 (PDT) In-Reply-To: <9c5de333-276c-4e3a-be5a-4e5a98cdaa1d@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:120b:c3e3:9270:5c1d:44fe:461c:a07f; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 2a02:120b:c3e3:9270:5c1d:44fe:461c:a07f References: <9c5de333-276c-4e3a-be5a-4e5a98cdaa1d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Integer Overflow Question. From: gautier_niouzes@hotmail.com Injection-Date: Mon, 25 Aug 2014 12:20:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:21899 Date: 2014-08-25T05:20:02-07:00 List-Id: Le lundi 25 ao=FBt 2014 13:21:33 UTC+2, austin.o...@btinternet.com a =E9cri= t=A0: > I have written two Ada driven ciphers that are complete and have been twe= aked for the last time. >=20 >=20 >=20 > I have used an early Ada compiler - a Gnat311.p - of about 1995 vintage = <=3D Ada-95. >=20 >=20 >=20 > In order that the ciphers can run in 32-bit computers which are still goi= ng to be around for some time despite the availability of the 64-bit operat= ing system in Windows 8.1 which I also use, I have had to put a bound on th= e maximum integer size output of computations at 2^31 which of course is th= e maximum positive integer that 32-bit computers can handle. >=20 >=20 >=20 > Running the same software that was written for 32-bit computers in the 6= 4-bit environment of 8.1 and raising the bar on integer size I thought I sh= ould be able to do this ok but no - the cipher will still crash if the inte= ger size is greater than 2^31 when I thought I could go up to 2^63. >=20 >=20 >=20 > As it happens this is not a problem crypto wise because the cipher is ind= ependent of the integer size but I am intrigued that this overflow should s= till happen. >=20 >=20 >=20 > I am coming to the conclusion that the max integer size than can be used = without integer overflow occurring in any computer is a function of the Ada= compiler being used and not the computer operating system??? This is the case. This is also the case for most software installed (Word, = Excel,...) which appear in a "C:\Program Files x86" folder. They all run in= a 32-bit subsystem of your 64-bit system. If you want to know metrics of your Ada numeric types, just display T'Last,= T'Size. Now, even on GNAT 32-bit, there are Integer_64 and Unsigned_64 in the Inter= faces package. Use them! HTH _________________________=20 Gautier's Ada programming=20 http://sf.net/users/gdemont