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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!8g2000prb.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Wed, 9 Feb 2011 13:23:57 -0800 (PST) Organization: http://groups.google.com Message-ID: <57033fe3-b115-4cd4-9e5f-6457d8ff95dc@8g2000prb.googlegroups.com> References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <4d51905c$0$19486$882e7ee2@usenet-news.net> <36212a7b-deab-45d9-ac45-aa29cd90c7bc@o18g2000prh.googlegroups.com> <4d51a7bb$0$19486$882e7ee2@usenet-news.net> <4d52b489$0$19486$882e7ee2@usenet-news.net> <9a8njlwvey1p.1a96yvvgdf6yu.dlg@40tude.net> <4d52c5e5$0$19486$882e7ee2@usenet-news.net> <4d52d7d9$0$18057$882e7ee2@usenet-news.net> <1jf3s95v7yrkk.1m7rl9zt042py$.dlg@40tude.net> <4d52e704$0$18057$882e7ee2@usenet-news.net> <271ad249-94dd-43d9-b550-59bd8e2208fc@y12g2000prf.googlegroups.com> <4d52f25d$0$18057$882e7ee2@usenet-news.net> <9a383662-5b92-4ac8-8446-67be342d97bd@r19g2000prm.googlegroups.com> <4d530522$0$18057$882e7ee2@usenet-news.net> NNTP-Posting-Host: 174.28.151.164 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1297286637 12337 127.0.0.1 (9 Feb 2011 21:23:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Feb 2011 21:23:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 8g2000prb.googlegroups.com; posting-host=174.28.151.164; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:17162 Date: 2011-02-09T13:23:57-08:00 List-Id: On Feb 9, 2:20=A0pm, Hyman Rosen wrote: > On 2/9/2011 3:25 PM, Shark8 wrote: > > > No, yours rejects signed values for the bases; mine does not... > > thus it violates the equal-inputs requirement. > > If you insist: > > long Exponent(long base, unsigned exp) > { > =A0 =A0 =A0if (exp =3D=3D 0) return 1; > =A0 =A0 =A0if (base =3D=3D 0) return 0; > =A0 =A0 =A0int sign =3D base < 0 && exp % 2 =3D=3D 1 ? -1 : 1; > =A0 =A0 =A0if (base < 0) base =3D -base; > =A0 =A0 =A0while (true) > =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0long guess =3D random(); > =A0 =A0 =A0 =A0 =A0long g =3D guess; > =A0 =A0 =A0 =A0 =A0unsigned i =3D 0; > =A0 =A0 =A0 =A0 =A0while (g % base =3D=3D 0 && i < exp) > =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0g /=3D base; > =A0 =A0 =A0 =A0 =A0 =A0 =A0++i; > =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0if (g =3D=3D 1 && i =3D=3D exp) return guess * sign; > =A0 =A0 =A0} > > } > > OK, now can I use my routine instead of yours? Almost: prove it returns.