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: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!o18g2000prh.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Tue, 8 Feb 2011 13:31:29 -0800 (PST) Organization: http://groups.google.com Message-ID: <44254ef2-5066-414d-8c1f-1021f9a9ebc9@o18g2000prh.googlegroups.com> References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <19fh1chm74f9.11cws0j5bckze.dlg@40tude.net> <4d4ff70e$0$6886$9b4e6d93@newsspool2.arcor-online.net> <737a6396-72bd-4a1e-8895-7d50f287960e@d28g2000yqc.googlegroups.com> <4d5008a5$0$6879$9b4e6d93@newsspool2.arcor-online.net> <4d5031fe$0$6765$9b4e6d93@newsspool3.arcor-online.net> <1f229967-d3cf-42b6-8087-c97ee08652f3@i40g2000yqh.googlegroups.com> <4d51169e$0$7657$9b4e6d93@newsspool1.arcor-online.net> <1bnp0pw1c8r5b$.guxc48qweiwe.dlg@40tude.net> <1ju2bba947c1h.y05qev0wjx2t.dlg@40tude.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 1297200689 19623 127.0.0.1 (8 Feb 2011 21:31:29 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Feb 2011 21:31:29 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o18g2000prh.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:17046 Date: 2011-02-08T13:31:29-08:00 List-Id: On Feb 8, 1:44=A0pm, "Dmitry A. Kazakov" wrote: > > The next test was this: > > =A0 =A0x and FF =3D ? > =A0 =A0x or FF =3D ? > =A0 =A0x xor FF =3D ? > ...w.t.f. That's insane... how is it I'm not even getting to the interview stage? I could do that; though I'm loathe to in C/C++. // we do have a bool type on this compiler, no? bool and ( int v1, int v2 ) { int result =3D 0; for (int index =3D 7; index>=3D0; --index) { result |=3D (( v1>>index && v2>>index ) && 1) << index; } return result; } bool or ( int v1, int v2 ) { int result =3D 0; for (int index =3D 7; index>=3D0; --index) { result |=3D (( v1>>index || v2>>index ) && 1) << index; } return result; } bool xor ( int v1, int v2 ) { int result =3D 0; int not_and =3D !and( v1, v2 ); int _or =3D or( v1, v2 ); for (int index =3D 7; index>=3D0; --index) { result |=3D (( not_and>>index && _or>>index ) && 1) << index; } return result; }