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.2 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, FROM_STARTS_WITH_NUMS 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-7-bit Path: g2news1.google.com!news3.google.com!news1.google.com!news.glorb.com!news2.glorb.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Wed, 09 Feb 2011 19:39:01 +0100 Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <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> <4d51a1c0$0$19486$882e7ee2@usenet-news.net> <87411ec5-c197-4143-8ef1-ab9ddb20bcc6@q40g2000prh.googlegroups.com> <505a0855-ed01-4819-9d8e-025ad8d5cb51@y12g2000prf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: individual.net Zc+AE6+2DADVGQouuFweYwqJX3YRJsHGUez2D3hStwcTfe/zvr Cancel-Lock: sha1:8rMx1HCQOzAYnup2+ha1TO6rPHg= User-Agent: Opera Mail/11.01 (Win32) Xref: g2news1.google.com comp.lang.ada:17118 Date: 2011-02-09T19:39:01+01:00 List-Id: Adam Beneschan wrote: > On Feb 8, 1:16 pm, "Vinzent Hoefler" > <0439279208b62c95f1880bf0f8776...@t-domaingrabbing.de> wrote: >> Adam Beneschan wrote: >> > On Feb 8, 12:01 pm, Hyman Rosen wrote: >> >> On 2/8/2011 2:43 PM, Dmitry A. Kazakov wrote: >> >> >> > Three candidates in a row I have interviewed for a C/C++/C# position could >> >> > not answer the question how to test the 3rd bit of a byte in C. All three >> >> > had 3+ years of programming "experience." >> >> >> (byte & (1 << (3 - 1))) >> >> > That's not the correct answer. The correct answer is to ask, "Third >> > bit from which end?" >> >> From the less significant end, unless you want the bit numbers to change when >> assigned to different sized variables. > > The original question was how to test the 3rd bit of a *byte* (let's > assume "byte" means 8 bits), not how to test the 3rd bit of an > mathematical integer value that could be stored in variables of > different sizes. So bit 3 of a 32-bit word is a different bit than that of a byte? > between computers use the terms "bit 0", "bit 1", "bit 2"---and I've > seen those terms used both ways, i.e. where bit 0 refers to the high- > order bit, or where it refers to the low-order bit. Those data-sheets which count from the wrong side simply have it wrong. As long as you can't address individual bits (and I am not talking about bit set instructions which some CPUs have, but real addresses), the notion of endianess for bit-order does not make sense. You could not even tell the difference. Vinzent. -- You know, we're sitting on four million pounds of fuel, one nuclear weapon, and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it? -- Rockhound, "Armageddon"