From: Wolfgang Denk Date: Tue, 12 Jul 2011 21:30:29 +0200 Subject: [U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks In-Reply-To: References: <1309884558-7700-1-git-send-email-sjg@chromium.org> <1309884558-7700-2-git-send-email-sjg@chromium.org> <4E185DFC.9010605@aribaud.net> <20110711061633.7A28E1579E14@gemini.denx.de> Message-ID: <20110712193029.5571F16F12CE@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Anton Staaf, In message you wrote: > > > Sorry, but because such code is unportable we do not accept it, as it > > would lead to driver code that becomes unportable, too. > > > > I know that this is throwing more fuel on the fire (for which I am sorry), You don't have to apologize. I think it is important that everybody understands the reasons behind such decisions. > but I don't follow the argument that this is unportable. As far as I can > tell, the # : # syntax is not using any special compiler extensions, it is > simply substituted into a (boo) ? # : # expression, thus extracting either > the first of second number from the definition of the bit field. > > If I am wrong I would be interested to know what about this is not standard > pre-processor usage? I did not say anything about preprocessor issues. The use of bit numbers (and ranges of bit numbers) in code is inherently unportable. For example: "Bit 10" means 0x00000400 on some systems (like, for example, on ARM), but it means 0x00200000 on others (like, for example, on PPC). On many systems bit 0 means trhe LSB, but the Power Architecture defines it as the MSB. Thus bit numbers should never be used in any code to access bits or to create masks etc. - they are not generally applicable. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "In Christianity neither morality nor religion come into contact with reality at any point." - Friedrich Nietzsche